[PATCH v2 2/6] models: Add Bundle.is_editable function

Andy Doan andy.doan at linaro.org
Wed Mar 15 02:44:07 AEDT 2017


On 03/07/2017 01:22 PM, Stephen Finucane wrote:
> We'll use this for the REST API.
>
> Signed-off-by: Stephen Finucane <stephen at that.guru>
> Cc: Daniel Axtens <dja at axtens.net>

This looks fine to me, but I don't see where this call is ever used in 
this patch set?

> ---
>  patchwork/models.py | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/patchwork/models.py b/patchwork/models.py
> index 94aaa0f..cfe5b51 100644
> --- a/patchwork/models.py
> +++ b/patchwork/models.py
> @@ -734,6 +734,11 @@ class Bundle(models.Model):
>                                              'bundlename': self.name
>                                          }))
>
> +    def is_editable(self, user):
> +        if not user.is_authenticated():
> +            return False
> +        return user == self.owner
> +
>      @models.permalink
>      def get_absolute_url(self):
>          return ('bundle-detail', (), {
>



More information about the Patchwork mailing list