[v3,2/5] models: Add 'mbox_url' permalink for bundles

Submitted by Stephen Finucane on March 16, 2017, 10:07 p.m.

Details

Message ID 20170316220728.10817-3-stephen@that.guru
State Accepted
Headers show

Commit Message

Stephen Finucane March 16, 2017, 10:07 p.m.
We're going to use this for downloading mboxes via the REST API.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
---
 patchwork/models.py | 5 +++++
 1 file changed, 5 insertions(+)

Patch hide | download patch | download mbox

diff --git a/patchwork/models.py b/patchwork/models.py
index 94aaa0f..199c118 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -741,6 +741,11 @@  class Bundle(models.Model):
             'bundlename': self.name,
         })
 
+    @models.permalink
+    def get_mbox_url(self):
+        return ('bundle-mbox', (), {'bundlename': self.name,
+                                    'username': self.owner.username})
+
     class Meta:
         unique_together = [('owner', 'name')]