[PATCH 5/5] forms: Trivial reshuffling of file

Stephen Finucane stephen at that.guru
Sun Nov 20 01:02:32 AEDT 2016


Group all "optional" fields.

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 patchwork/forms.py | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/patchwork/forms.py b/patchwork/forms.py
index 3ccf754..7f57497 100644
--- a/patchwork/forms.py
+++ b/patchwork/forms.py
@@ -17,14 +17,15 @@
 # along with Patchwork; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import absolute_import
-
 from django.contrib.auth.models import User
 from django import forms
 from django.db.models import Q
 from django.db.utils import ProgrammingError
 
-from patchwork.models import Patch, State, Bundle, UserProfile
+from patchwork.models import Bundle
+from patchwork.models import Patch
+from patchwork.models import State
+from patchwork.models import UserProfile
 
 
 class RegistrationForm(forms.Form):
@@ -63,6 +64,10 @@ class LoginForm(forms.Form):
     password = forms.CharField(widget=forms.PasswordInput)
 
 
+class EmailForm(forms.Form):
+    email = forms.EmailField(max_length=200)
+
+
 class BundleForm(forms.ModelForm):
     name = forms.RegexField(
         regex=r'^[^/]+$', max_length=50, label=u'Name',
@@ -98,6 +103,13 @@ class DeleteBundleForm(forms.Form):
     bundle_id = forms.IntegerField(widget=forms.HiddenInput)
 
 
+class UserProfileForm(forms.ModelForm):
+
+    class Meta:
+        model = UserProfile
+        fields = ['items_per_page']
+
+
 def _get_delegate_qs(project, instance=None):
     if instance and not project:
         project = instance.project
@@ -125,13 +137,6 @@ class PatchForm(forms.ModelForm):
         fields = ['state', 'archived', 'delegate']
 
 
-class UserProfileForm(forms.ModelForm):
-
-    class Meta:
-        model = UserProfile
-        fields = ['items_per_page']
-
-
 class OptionalModelChoiceField(forms.ModelChoiceField):
     no_change_choice = ('*', 'no change')
     to_field_name = None
@@ -205,7 +210,3 @@ class MultiplePatchForm(forms.Form):
         if commit:
             instance.save()
         return instance
-
-
-class EmailForm(forms.Form):
-    email = forms.EmailField(max_length=200)
-- 
2.7.4



More information about the Patchwork mailing list