Add less-than methods for Repo and Arch

These are the methods guaranteed to be used by the python sort
functions; define them so we can simplify sorting code elsewhere as
needed.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2010-11-27 14:43:01 -06:00
parent a52a46cee2
commit 21c48f9fbc

View File

@ -67,6 +67,9 @@ class Arch(models.Model):
def __unicode__(self): def __unicode__(self):
return self.name return self.name
def __lt__(self, other):
return self.name < other.name
class Meta: class Meta:
db_table = 'arches' db_table = 'arches'
ordering = ['name'] ordering = ['name']
@ -85,6 +88,9 @@ class Repo(models.Model):
def __unicode__(self): def __unicode__(self):
return self.name return self.name
def __lt__(self, other):
return self.name < other.name
class Meta: class Meta:
db_table = 'repos' db_table = 'repos'
ordering = ['name'] ordering = ['name']