summaryrefslogtreecommitdiff
path: root/main/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-03-13 11:41:36 -0500
committerDan McGee <dan@archlinux.org>2011-03-13 11:41:36 -0500
commit5abe0727bfa9a4fab24afcccb66da7d8832bf6b9 (patch)
tree1b2f2bcce81e1b0b755698c4efdff29b9bd3075e /main/models.py
parent9730be60a8ef4a04358b0a026ce6b706de21d4e8 (diff)
Show epoch in package version if != 0
Add a full_version property method to our package object that does the version formatting, and switch all templates displaying package versions over to this new method. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main/models.py')
-rw-r--r--main/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/models.py b/main/models.py
index d0ccb12a..727dc010 100644
--- a/main/models.py
+++ b/main/models.py
@@ -131,6 +131,12 @@ class Package(models.Model):
def __unicode__(self):
return self.pkgname
+ @property
+ def full_version(self):
+ if self.epoch > 0:
+ return u'%d:%s-%s' % (self.epoch, self.pkgver, self.pkgrel)
+ return u'%s-%s' % (self.pkgver, self.pkgrel)
+
def get_absolute_url(self):
return '/packages/%s/%s/%s/' % (self.repo.name.lower(),
self.arch.name, self.pkgname)