djeuscan: add cp() and cpv() for Package and Version
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
This commit is contained in:
parent
b0cd34ed75
commit
9617fd25a1
@ -88,9 +88,12 @@ class Package(models.Model):
|
|||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ['category', 'name']
|
unique_together = ['category', 'name']
|
||||||
|
|
||||||
def __unicode__(self):
|
def cp(self):
|
||||||
return '%s/%s' % (self.category, self.name)
|
return '%s/%s' % (self.category, self.name)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.cp()
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
self.full_clean()
|
self.full_clean()
|
||||||
|
|
||||||
@ -137,10 +140,17 @@ class Version(models.Model):
|
|||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ['package', 'slot', 'revision', 'version', 'overlay']
|
unique_together = ['package', 'slot', 'revision', 'version', 'overlay']
|
||||||
|
|
||||||
|
def cpv(self):
|
||||||
|
return '%s/%s-%s-%s' % (
|
||||||
|
self.package.category, self.package.name, self.version,
|
||||||
|
self.revision if self.revision != 'r0' else ''
|
||||||
|
)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return '%s/%s-%s-%s:%s [%s]' % (
|
return '%s/%s-%s-%s:%s [%s]' % (
|
||||||
self.package.category, self.package.name, self.version,
|
self.package.category, self.package.name, self.version,
|
||||||
self.revision, self.slot, self.overlay or "<upstream>"
|
self.revision if self.revision != 'r0' else '',
|
||||||
|
self.slot, self.overlay or "<upstream>"
|
||||||
)
|
)
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user