euscan: last_version property added
Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
parent
ddd8be39f5
commit
c519f6b28a
2
TODO
2
TODO
@ -79,8 +79,6 @@ Move log models into djeuscanhistory ?
|
||||
- Url ad ManyToMany
|
||||
- Arches and Keyword
|
||||
- Metadata, herds, maintainers and homepage are per-version, not per package. Store it in Version instead.
|
||||
Define last_version that refers to the last version (can be last_version_gentoo or last_version_overlay)
|
||||
Fix update_counter, to update this field.
|
||||
|
||||
### djportage (LOW-PRIORITY))
|
||||
|
||||
|
@ -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):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user