bitbake: toaster: models Layer_Version get_detailspage_url optional project_id

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>
This commit is contained in:
Michael Wood 2016-12-09 16:52:44 +00:00 committed by Richard Purdie
parent 9dbcc0fbb3
commit 90d995c637
1 changed files with 7 additions and 1 deletions

View 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):