[PATCH 3/5] models: Add 'mbox_url' permalink for bundles

Stephen Finucane stephen at that.guru
Sat Feb 25 23:05:22 AEDT 2017


We're going to use this for downloading mboxes via 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 27e576f..214b75c 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -744,6 +744,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')]
 
-- 
2.9.3



More information about the Patchwork mailing list