[PATCH 2/5] forms: Remove unused args in forms

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


There were a couple of forms that offered configurabilty, but this
configurability wasn't used anywhere. Simplify things and remove any
related code.

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

diff --git a/patchwork/forms.py b/patchwork/forms.py
index 702779e..a7dd48d 100644
--- a/patchwork/forms.py
+++ b/patchwork/forms.py
@@ -137,12 +137,9 @@ class OptionalDelegateField(DelegateField):
     no_change_choice = ('*', 'no change')
     to_field_name = None
 
-    def __init__(self, no_change_choice=None, *args, **kwargs):
-        self.filter = None
-        if (no_change_choice):
-            self.no_change_choice = no_change_choice
-        super(OptionalDelegateField, self). \
-            __init__(initial=self.no_change_choice[0], *args, **kwargs)
+    def __init__(self, *args, **kwargs):
+        super(OptionalDelegateField, self).__init__(
+            initial=self.no_change_choice[0], *args, **kwargs)
 
     def _get_choices(self):
         choices = list(
@@ -165,12 +162,9 @@ class OptionalModelChoiceField(forms.ModelChoiceField):
     no_change_choice = ('*', 'no change')
     to_field_name = None
 
-    def __init__(self, no_change_choice=None, *args, **kwargs):
-        self.filter = None
-        if (no_change_choice):
-            self.no_change_choice = no_change_choice
-        super(OptionalModelChoiceField, self). \
-            __init__(initial=self.no_change_choice[0], *args, **kwargs)
+    def __init__(self, *args, **kwargs):
+        super(OptionalModelChoiceField, self).__init__(
+            initial=self.no_change_choice[0], *args, **kwargs)
 
     def _get_choices(self):
         # _get_choices queries the database, which can fail if the db
-- 
2.7.4



More information about the Patchwork mailing list