diff options
author | Dan McGee <dan@archlinux.org> | 2012-08-08 22:04:07 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-08-08 22:04:07 -0500 |
commit | 411ccfb3c74c521969ca6b68459289134976547d (patch) | |
tree | 598129fed89367ba9ac269fd461d420b5d3fde84 /packages/models.py | |
parent | 978a5c61a5412eeed054307d3e2979324ffcb64a (diff) |
Begin split of flag request version column into parts
Not sure why on only this one I decided to put all three parts in the
same column. We don't do this anywhere else.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/models.py')
-rw-r--r-- | packages/models.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/models.py b/packages/models.py index 11fd0a66..03da27ec 100644 --- a/packages/models.py +++ b/packages/models.py @@ -177,6 +177,9 @@ class FlagRequest(models.Model): unpack_ipv4=True) pkgbase = models.CharField(max_length=255, db_index=True) version = models.CharField(max_length=255) + pkgver = models.CharField(max_length=255) + pkgrel = models.CharField(max_length=255) + epoch = models.PositiveIntegerField(default=0) repo = models.ForeignKey(Repo) num_packages = models.PositiveIntegerField('number of packages', default=1) message = models.TextField('message to developer', blank=True) @@ -193,6 +196,17 @@ class FlagRequest(models.Model): return self.user.get_full_name() return self.user_email + @property + def full_version(self): + # Difference here from other implementations at the moment: we need to + # handle the case of pkgver and pkgrel being null as this table didn't + # originally have version columns. + if self.pkgver == '' and self.pkgrel == '': + return u'' + if self.epoch > 0: + return u'%d:%s-%s' % (self.epoch, self.pkgver, self.pkgrel) + return u'%s-%s' % (self.pkgver, self.pkgrel) + def __unicode__(self): return u'%s from %s on %s' % (self.pkgbase, self.who(), self.created) |