[PATCH 2/5] models: Add Bundle.is_editable function
Stephen Finucane
stephen at that.guru
Sat Feb 25 23:05:21 AEDT 2017
We'll use this for the REST API.
Signed-off-by: Stephen Finucane <stephen at that.guru>
Cc: Daniel Axtens <dja at axtens.net>
---
patchwork/models.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/patchwork/models.py b/patchwork/models.py
index ae40668..27e576f 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -732,6 +732,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', (), {
--
2.9.3
More information about the Patchwork
mailing list