bitbake: toaster: orm Add util function to return the url to layerversion

Save duplicating this call and make a utility function for it on the
Layer_Version object.

(Bitbake rev: 32d382315bad37cebbe67ca3287085f3d856a9ed)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Michael Wood
2015-08-04 22:46:29 +03:00
committed by Richard Purdie
parent c8bc7ee6ed
commit d3b9927a3c

View File

@@ -23,6 +23,7 @@ from django.db import models
from django.db.models import F, Q, Avg from django.db.models import F, Q, Avg
from django.utils import timezone from django.utils import timezone
from django.core.urlresolvers import reverse
from django.core import validators from django.core import validators
from django.conf import settings from django.conf import settings
@@ -1109,6 +1110,9 @@ class Layer_Version(models.Model):
return self.up_branch.name return self.up_branch.name
return ("Cannot determine the vcs_reference for layer version %s" % vars(self)) return ("Cannot determine the vcs_reference for layer version %s" % vars(self))
def get_detailspage_url(self, project_id):
return reverse('layerdetails', args=(project_id, self.pk))
def __unicode__(self): def __unicode__(self):
return "%d %s (VCS %s, Project %s)" % (self.pk, str(self.layer), self.get_vcs_reference(), self.build.project if self.build is not None else "No project") return "%d %s (VCS %s, Project %s)" % (self.pk, str(self.layer), self.get_vcs_reference(), self.build.project if self.build is not None else "No project")