Continue to attack E302 violations
This commit is contained in:
@@ -14,21 +14,25 @@ from django.contrib.formtools.wizard.views import NamedUrlWizardView
|
|||||||
temp_storage_location = tempfile.mkdtemp(dir=os.environ.get('DJANGO_TEST_TEMP_DIR'))
|
temp_storage_location = tempfile.mkdtemp(dir=os.environ.get('DJANGO_TEST_TEMP_DIR'))
|
||||||
temp_storage = FileSystemStorage(location=temp_storage_location)
|
temp_storage = FileSystemStorage(location=temp_storage_location)
|
||||||
|
|
||||||
|
|
||||||
class Page1(forms.Form):
|
class Page1(forms.Form):
|
||||||
name = forms.CharField(max_length=100)
|
name = forms.CharField(max_length=100)
|
||||||
user = forms.ModelChoiceField(queryset=User.objects.all())
|
user = forms.ModelChoiceField(queryset=User.objects.all())
|
||||||
thirsty = forms.NullBooleanField()
|
thirsty = forms.NullBooleanField()
|
||||||
|
|
||||||
|
|
||||||
class Page2(forms.Form):
|
class Page2(forms.Form):
|
||||||
address1 = forms.CharField(max_length=100)
|
address1 = forms.CharField(max_length=100)
|
||||||
address2 = forms.CharField(max_length=100)
|
address2 = forms.CharField(max_length=100)
|
||||||
file1 = forms.FileField()
|
file1 = forms.FileField()
|
||||||
|
|
||||||
|
|
||||||
class Page3(forms.Form):
|
class Page3(forms.Form):
|
||||||
random_crap = forms.CharField(max_length=100)
|
random_crap = forms.CharField(max_length=100)
|
||||||
|
|
||||||
Page4 = formset_factory(Page3, extra=2)
|
Page4 = formset_factory(Page3, extra=2)
|
||||||
|
|
||||||
|
|
||||||
class ContactWizard(NamedUrlWizardView):
|
class ContactWizard(NamedUrlWizardView):
|
||||||
file_storage = temp_storage
|
file_storage = temp_storage
|
||||||
|
|
||||||
@@ -44,8 +48,10 @@ class ContactWizard(NamedUrlWizardView):
|
|||||||
c['this_will_fail'] = self.get_cleaned_data_for_step('this_will_fail')
|
c['this_will_fail'] = self.get_cleaned_data_for_step('this_will_fail')
|
||||||
return HttpResponse(Template('').render(c))
|
return HttpResponse(Template('').render(c))
|
||||||
|
|
||||||
|
|
||||||
class SessionContactWizard(ContactWizard):
|
class SessionContactWizard(ContactWizard):
|
||||||
storage_name = 'django.contrib.formtools.wizard.storage.session.SessionStorage'
|
storage_name = 'django.contrib.formtools.wizard.storage.session.SessionStorage'
|
||||||
|
|
||||||
|
|
||||||
class CookieContactWizard(ContactWizard):
|
class CookieContactWizard(ContactWizard):
|
||||||
storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'
|
storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from django.conf.urls import patterns, url
|
|||||||
from django.contrib.formtools.tests.wizard.namedwizardtests.forms import (
|
from django.contrib.formtools.tests.wizard.namedwizardtests.forms import (
|
||||||
SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)
|
SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)
|
||||||
|
|
||||||
|
|
||||||
def get_named_session_wizard():
|
def get_named_session_wizard():
|
||||||
return SessionContactWizard.as_view(
|
return SessionContactWizard.as_view(
|
||||||
[('form1', Page1), ('form2', Page2), ('form3', Page3), ('form4', Page4)],
|
[('form1', Page1), ('form2', Page2), ('form3', Page3), ('form4', Page4)],
|
||||||
@@ -9,6 +10,7 @@ def get_named_session_wizard():
|
|||||||
done_step_name='nwiz_session_done'
|
done_step_name='nwiz_session_done'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_named_cookie_wizard():
|
def get_named_cookie_wizard():
|
||||||
return CookieContactWizard.as_view(
|
return CookieContactWizard.as_view(
|
||||||
[('form1', Page1), ('form2', Page2), ('form3', Page3), ('form4', Page4)],
|
[('form1', Page1), ('form2', Page2), ('form3', Page3), ('form4', Page4)],
|
||||||
|
|||||||
@@ -81,12 +81,14 @@ class TestWizard(WizardView):
|
|||||||
kwargs['test'] = True
|
kwargs['test'] = True
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
|
||||||
class TestWizardWithInitAttrs(TestWizard):
|
class TestWizardWithInitAttrs(TestWizard):
|
||||||
form_list = [Step1, Step2]
|
form_list = [Step1, Step2]
|
||||||
condition_dict = {'step2': True}
|
condition_dict = {'step2': True}
|
||||||
initial_dict = {'start': {'name': 'value1'}}
|
initial_dict = {'start': {'name': 'value1'}}
|
||||||
instance_dict = {'start': User()}
|
instance_dict = {'start': User()}
|
||||||
|
|
||||||
|
|
||||||
class FormTests(TestCase):
|
class FormTests(TestCase):
|
||||||
def test_form_init(self):
|
def test_form_init(self):
|
||||||
testform = TestWizard.get_initkwargs([Step1, Step2])
|
testform = TestWizard.get_initkwargs([Step1, Step2])
|
||||||
|
|||||||
@@ -15,21 +15,25 @@ from django.contrib.formtools.wizard.views import WizardView
|
|||||||
temp_storage_location = tempfile.mkdtemp(dir=os.environ.get('DJANGO_TEST_TEMP_DIR'))
|
temp_storage_location = tempfile.mkdtemp(dir=os.environ.get('DJANGO_TEST_TEMP_DIR'))
|
||||||
temp_storage = FileSystemStorage(location=temp_storage_location)
|
temp_storage = FileSystemStorage(location=temp_storage_location)
|
||||||
|
|
||||||
|
|
||||||
class Page1(forms.Form):
|
class Page1(forms.Form):
|
||||||
name = forms.CharField(max_length=100)
|
name = forms.CharField(max_length=100)
|
||||||
user = forms.ModelChoiceField(queryset=User.objects.all())
|
user = forms.ModelChoiceField(queryset=User.objects.all())
|
||||||
thirsty = forms.NullBooleanField()
|
thirsty = forms.NullBooleanField()
|
||||||
|
|
||||||
|
|
||||||
class Page2(forms.Form):
|
class Page2(forms.Form):
|
||||||
address1 = forms.CharField(max_length=100)
|
address1 = forms.CharField(max_length=100)
|
||||||
address2 = forms.CharField(max_length=100)
|
address2 = forms.CharField(max_length=100)
|
||||||
file1 = forms.FileField()
|
file1 = forms.FileField()
|
||||||
|
|
||||||
|
|
||||||
class Page3(forms.Form):
|
class Page3(forms.Form):
|
||||||
random_crap = forms.CharField(max_length=100)
|
random_crap = forms.CharField(max_length=100)
|
||||||
|
|
||||||
Page4 = formset_factory(Page3, extra=2)
|
Page4 = formset_factory(Page3, extra=2)
|
||||||
|
|
||||||
|
|
||||||
class ContactWizard(WizardView):
|
class ContactWizard(WizardView):
|
||||||
file_storage = temp_storage
|
file_storage = temp_storage
|
||||||
|
|
||||||
@@ -51,6 +55,7 @@ class ContactWizard(WizardView):
|
|||||||
context.update({'another_var': True})
|
context.update({'another_var': True})
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class UserForm(forms.ModelForm):
|
class UserForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
@@ -58,8 +63,10 @@ class UserForm(forms.ModelForm):
|
|||||||
|
|
||||||
UserFormSet = modelformset_factory(User, form=UserForm)
|
UserFormSet = modelformset_factory(User, form=UserForm)
|
||||||
|
|
||||||
|
|
||||||
class SessionContactWizard(ContactWizard):
|
class SessionContactWizard(ContactWizard):
|
||||||
storage_name = 'django.contrib.formtools.wizard.storage.session.SessionStorage'
|
storage_name = 'django.contrib.formtools.wizard.storage.session.SessionStorage'
|
||||||
|
|
||||||
|
|
||||||
class CookieContactWizard(ContactWizard):
|
class CookieContactWizard(ContactWizard):
|
||||||
storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'
|
storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
|
|
||||||
class ManagementForm(forms.Form):
|
class ManagementForm(forms.Form):
|
||||||
"""
|
"""
|
||||||
``ManagementForm`` is used to keep track of the current wizard step.
|
``ManagementForm`` is used to keep track of the current wizard step.
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
|
||||||
|
|
||||||
class MissingStorage(ImproperlyConfigured):
|
class MissingStorage(ImproperlyConfigured):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NoFileStorageConfigured(ImproperlyConfigured):
|
class NoFileStorageConfigured(ImproperlyConfigured):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ def normalize_name(name):
|
|||||||
new = re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', '_\\1', name)
|
new = re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', '_\\1', name)
|
||||||
return new.lower().strip('_')
|
return new.lower().strip('_')
|
||||||
|
|
||||||
|
|
||||||
class StepsHelper(object):
|
class StepsHelper(object):
|
||||||
|
|
||||||
def __init__(self, wizard):
|
def __init__(self, wizard):
|
||||||
|
|||||||
Reference in New Issue
Block a user