From: Stephen Finucane Date: Tue, 19 Jul 2022 15:05:32 +0000 (+0100) Subject: forms: Trivial cleanup X-Git-Tag: v3.2.0~118 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ce5c6e22f4730ae5054ee762df5bd7e7e79c7f57;p=thirdparty%2Fpatchwork.git forms: Trivial cleanup Signed-off-by: Stephen Finucane --- diff --git a/patchwork/forms.py b/patchwork/forms.py index a60578be..f5596aa9 100644 --- a/patchwork/forms.py +++ b/patchwork/forms.py @@ -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=[