summaryrefslogtreecommitdiff
path: root/patchwork/forms.py
diff options
context:
space:
mode:
authorStephen Finucane <stephen.finucane@intel.com>2015-08-24 14:21:43 +0100
committerStephen Finucane <stephen.finucane@intel.com>2016-01-25 16:23:51 +0000
commite0fd7cd91a5fbe0a0077c46bea870ccd09c8920d (patch)
tree81cadef20c045c548e1980e22ceb519153d06a69 /patchwork/forms.py
parentf439f5414206c94d486c60801a86acc57ad3f273 (diff)
downloadpatchwork-e0fd7cd91a5fbe0a0077c46bea870ccd09c8920d.tar
patchwork-e0fd7cd91a5fbe0a0077c46bea870ccd09c8920d.tar.gz
Allow assigning of any user as delegate
Currently, Patchwork only allows to delegate patches to developers who are registered as "maintainers" of the project in Patchwork or set up as autodelegate "targets". This is a bit annoying as "maintainers" in the Patchwork sense have the power to change the state of *any* patch. Allow delegation of patches to developers who are not the submitter of the patch in question, a maintainer of the project or an autodelegate "target". This request is documented here: https://lists.ozlabs.org/pipermail/patchwork/2015-July/001351.html Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Diffstat (limited to 'patchwork/forms.py')
-rw-r--r--patchwork/forms.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/patchwork/forms.py b/patchwork/forms.py
index 217e743..808ec8a 100644
--- a/patchwork/forms.py
+++ b/patchwork/forms.py
@@ -99,13 +99,8 @@ class DeleteBundleForm(forms.Form):
class DelegateField(forms.ModelChoiceField):
- def __init__(self, project, instance=None, *args, **kwargs):
- q = Q(profile__in=UserProfile.objects
- .filter(maintainer_projects=project)
- .values('pk').query)
- if instance and instance.delegate:
- q = q | Q(username=instance.delegate)
- queryset = User.objects.complex_filter(q)
+ def __init__(self, *args, **kwargs):
+ queryset = User.objects
super(DelegateField, self).__init__(queryset, *args, **kwargs)
@@ -117,8 +112,7 @@ class PatchForm(forms.ModelForm):
if not project:
raise Exception("meep")
super(PatchForm, self).__init__(instance=instance, *args, **kwargs)
- self.fields['delegate'] = DelegateField(project, instance,
- required=False)
+ self.fields['delegate'] = DelegateField(required=False)
class Meta:
model = Patch
@@ -225,8 +219,7 @@ class MultiplePatchForm(forms.Form):
def __init__(self, project, *args, **kwargs):
super(MultiplePatchForm, self).__init__(*args, **kwargs)
- self.fields['delegate'] = OptionalDelegateField(project=project,
- required=False)
+ self.fields['delegate'] = OptionalDelegateField(required=False)
def save(self, instance, commit=True):
opts = instance.__class__._meta