]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: toaster: models Layer_Version get_detailspage_url optional project_id
authorMichael Wood <michael.g.wood@intel.com>
Fri, 9 Dec 2016 16:52:44 +0000 (16:52 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 12 Dec 2016 20:44:53 +0000 (20:44 +0000)
Allow passing none as the project id, this is convenient for layers
which belong to projects already and therefore have their own project
field.

Add documentation string to function

(Bitbake rev: 78dc7b9f1801e7f4c266ba1369e5706f177ddaa1)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/toaster/orm/models.py

index 4cd6683c321b1f5af173379266f113c19eb1c2ce..98745d69f6f02238f6417daa8661c3379b8b1171 100644 (file)
@@ -1493,7 +1493,13 @@ class Layer_Version(models.Model):
             return self.commit
         return 'N/A'
 
-    def get_detailspage_url(self, project_id):
+    def get_detailspage_url(self, project_id=None):
+        """ returns the url to the layer details page uses own project
+        field if project_id is not specified """
+
+        if project_id is None:
+            project_id = self.project.pk
+
         return reverse('layerdetails', args=(project_id, self.pk))
 
     def get_alldeps(self, project_id):