summaryrefslogtreecommitdiff
path: root/main/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-11-27 14:43:01 -0600
committerDan McGee <dan@archlinux.org>2010-11-27 14:43:01 -0600
commit21c48f9fbcdc6c42d664a09bda85285cbc7d72ec (patch)
tree64e7c0b04f310cbf77a3845e2ff01361fd79d12b /main/models.py
parenta52a46cee2befbf23513c2289f00bcca7115cde4 (diff)
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>
Diffstat (limited to 'main/models.py')
-rw-r--r--main/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/models.py b/main/models.py
index 6fdb862f..51cf89a8 100644
--- a/main/models.py
+++ b/main/models.py
@@ -67,6 +67,9 @@ class Arch(models.Model):
def __unicode__(self):
return self.name
+ def __lt__(self, other):
+ return self.name < other.name
+
class Meta:
db_table = 'arches'
ordering = ['name']
@@ -85,6 +88,9 @@ class Repo(models.Model):
def __unicode__(self):
return self.name
+ def __lt__(self, other):
+ return self.name < other.name
+
class Meta:
db_table = 'repos'
ordering = ['name']