]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
forms: Trivial cleanup
authorStephen Finucane <stephen@that.guru>
Tue, 19 Jul 2022 15:05:32 +0000 (16:05 +0100)
committerStephen Finucane <stephen@that.guru>
Sun, 2 Oct 2022 19:59:38 +0000 (20:59 +0100)
Signed-off-by: Stephen Finucane <stephen@that.guru>
patchwork/forms.py

index a60578be6b3bdcb4db0a5c71d3dd37d264f6642d..f5596aa94002a223b69fd0902e5da6ac39a952a5 100644 (file)
@@ -58,10 +58,6 @@ class RegistrationForm(forms.Form):
         return self.cleaned_data
 
 
-class EmailForm(forms.Form):
-    email = forms.EmailField(max_length=200)
-
-
 class BundleForm(forms.ModelForm):
     name = forms.RegexField(
         regex=r'^[^/]+$',
@@ -77,13 +73,6 @@ class BundleForm(forms.ModelForm):
 
 
 class CreateBundleForm(BundleForm):
-    def __init__(self, *args, **kwargs):
-        super(CreateBundleForm, self).__init__(*args, **kwargs)
-
-    class Meta:
-        model = Bundle
-        fields = ['name']
-
     def clean_name(self):
         name = self.cleaned_data['name']
         count = Bundle.objects.filter(
@@ -95,6 +84,10 @@ class CreateBundleForm(BundleForm):
             )
         return name
 
+    class Meta:
+        model = Bundle
+        fields = ['name']
+
 
 class DeleteBundleForm(forms.Form):
     name = 'deletebundleform'
@@ -102,6 +95,10 @@ class DeleteBundleForm(forms.Form):
     bundle_id = forms.IntegerField(widget=forms.HiddenInput)
 
 
+class EmailForm(forms.Form):
+    email = forms.EmailField(max_length=200)
+
+
 class UserProfileForm(forms.ModelForm):
     class Meta:
         model = UserProfile
@@ -123,6 +120,7 @@ def _get_delegate_qs(project, instance=None):
     )
     if instance and instance.delegate:
         q = q | Q(username=instance.delegate)
+
     return User.objects.complex_filter(q)
 
 
@@ -139,6 +137,7 @@ class PatchForm(forms.ModelForm):
 
 
 class OptionalModelChoiceField(forms.ModelChoiceField):
+
     no_change_choice = ('*', 'no change')
     to_field_name = None
 
@@ -177,6 +176,7 @@ class OptionalBooleanField(forms.TypedChoiceField):
 
 
 class MultiplePatchForm(forms.Form):
+
     action = 'update'
     archived = OptionalBooleanField(
         choices=[