Skip to content

Commit

Permalink
Sort documents and document types alphabetically by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
qris committed Apr 19, 2012
1 parent e85cbbd commit 1de31e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
# http://djangosnippets.org/snippets/1054/

class DocumentType(models.Model):
class Meta:
ordering = ('name',)

name = models.CharField(max_length=255, unique=True)
def __unicode__(self):
return self.name

class Document(models.Model):
class Meta:
ordering = ('title',)

title = models.CharField(max_length=255, unique=True)
document_type = models.ForeignKey(DocumentType)
programs = models.ManyToManyField(binder.models.Program)
Expand Down

0 comments on commit 1de31e4

Please sign in to comment.