]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
models: Add 'mbox_url' permalink for bundles
authorStephen Finucane <stephen@that.guru>
Tue, 21 Feb 2017 19:34:56 +0000 (14:34 -0500)
committerStephen Finucane <stephen@that.guru>
Mon, 20 Mar 2017 19:14:04 +0000 (19:14 +0000)
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

index 94aaa0f50bd6a21c583bd25b5cbea6b71fa984a5..199c11827475db9b7f32e0b158c3b3e2f010c5f0 100644 (file)
@@ -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')]