diff options
author | volpino <fox91@anche.no> | 2012-09-22 16:08:38 +0200 |
---|---|---|
committer | Corentin Chary <corentin.chary@gmail.com> | 2012-10-29 13:06:04 +0100 |
commit | c519f6b28a4becb227b74556cbbaed99bcef0553 (patch) | |
tree | 0daeb8dad38b7b7b1fcc1f901b2a3b2b4c6b65ef /euscanwww | |
parent | euscanwww: Wrapping herds and maintainers in <p> to put them in newlines (diff) | |
download | euscan-c519f6b28a4becb227b74556cbbaed99bcef0553.tar.gz euscan-c519f6b28a4becb227b74556cbbaed99bcef0553.tar.bz2 euscan-c519f6b28a4becb227b74556cbbaed99bcef0553.zip |
euscan: last_version property added
Signed-off-by: volpino <fox91@anche.no>
Diffstat (limited to 'euscanwww')
-rw-r--r-- | euscanwww/djeuscan/models.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/euscanwww/djeuscan/models.py b/euscanwww/djeuscan/models.py index cb0e0e0..a328522 100644 --- a/euscanwww/djeuscan/models.py +++ b/euscanwww/djeuscan/models.py @@ -116,6 +116,20 @@ class Package(models.Model): def homepages(self): return self.homepage.split(' ') + @property + def last_version(self): + from euscan.helpers import vercmp + + versions = [ + self.last_version_gentoo, + self.last_version_overlay, + self.last_version_upstream + ] + _cmp = lambda x, y: vercmp( + unicode(self), x.version if x else "", y.version if y else "" + ) + return sorted(versions, cmp=_cmp)[-1] + class Version(models.Model): """ |