[1/7] REST: Use UserFilter for patch delegates

Message ID 20180411161338.420-2-stephen@that.guru
State Accepted
Headers show
Series
  • Add support for multiple filters
Related show

Commit Message

Stephen Finucane April 11, 2018, 4:13 p.m.
Signed-off-by: Stephen Finucane <stephen@that.guru>
---
 patchwork/api/filters.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Daniel Axtens May 8, 2018, 3:18 p.m. | #1
Stephen Finucane <stephen@that.guru> writes:

> Signed-off-by: Stephen Finucane <stephen@that.guru>
> ---
>  patchwork/api/filters.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/patchwork/api/filters.py b/patchwork/api/filters.py
> index eed7995d..25956e98 100644
> --- a/patchwork/api/filters.py
> +++ b/patchwork/api/filters.py
> @@ -158,8 +158,9 @@ class CoverLetterFilter(ProjectMixin, TimestampMixin, FilterSet):
>  
>  class PatchFilter(ProjectMixin, TimestampMixin, FilterSet):
>  
> -    state = StateFilter(queryset=State.objects.all())
>      submitter = PersonFilter(queryset=Person.objects.all())
> +    delegate = UserFilter(queryset=User.objects.all())
> +    state = StateFilter(queryset=State.objects.all())
Minor nit, is there a reason state is moved?

Happy to fix when applying.

Regards,
Daniel

>  
>      class Meta:
>          model = Patch
> -- 
> 2.14.3
>
> _______________________________________________
> Patchwork mailing list
> Patchwork@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork
Stephen Finucane May 8, 2018, 3:38 p.m. | #2
On Wed, 2018-05-09 at 01:18 +1000, Daniel Axtens wrote:
> Stephen Finucane <stephen@that.guru> writes:
> 
> > Signed-off-by: Stephen Finucane <stephen@that.guru>
> > ---
> >  patchwork/api/filters.py | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/patchwork/api/filters.py b/patchwork/api/filters.py
> > index eed7995d..25956e98 100644
> > --- a/patchwork/api/filters.py
> > +++ b/patchwork/api/filters.py
> > @@ -158,8 +158,9 @@ class CoverLetterFilter(ProjectMixin, TimestampMixin, FilterSet):
> >  
> >  class PatchFilter(ProjectMixin, TimestampMixin, FilterSet):
> >  
> > -    state = StateFilter(queryset=State.objects.all())
> >      submitter = PersonFilter(queryset=Person.objects.all())
> > +    delegate = UserFilter(queryset=User.objects.all())
> > +    state = StateFilter(queryset=State.objects.all())
> 
> Minor nit, is there a reason state is moved?

Yup, it's a stylistic thing (the fields are in the same order that
they're listed in in 'Meta.fields'). You can drop this hunk if you'd
like but it's also no harm.

Stephen

> Happy to fix when applying.
> 
> Regards,
> Daniel
> 
> >  
> >      class Meta:
> >          model = Patch
> > -- 
> > 2.14.3
> > 
> > _______________________________________________
> > Patchwork mailing list
> > Patchwork@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/patchwork

Patch

diff --git a/patchwork/api/filters.py b/patchwork/api/filters.py
index eed7995d..25956e98 100644
--- a/patchwork/api/filters.py
+++ b/patchwork/api/filters.py
@@ -158,8 +158,9 @@  class CoverLetterFilter(ProjectMixin, TimestampMixin, FilterSet):
 
 class PatchFilter(ProjectMixin, TimestampMixin, FilterSet):
 
-    state = StateFilter(queryset=State.objects.all())
     submitter = PersonFilter(queryset=Person.objects.all())
+    delegate = UserFilter(queryset=User.objects.all())
+    state = StateFilter(queryset=State.objects.all())
 
     class Meta:
         model = Patch