From: Brett Parker Date: Wed, 3 Mar 2010 09:15:02 +0000 (+0000) Subject: Change sort ordering in admin, give more full path to item X-Git-Url: https://git.sommitrealweird.co.uk/sommitrealweird.git/commitdiff_plain/3c8f423203be690dd0bda32e90eec49f1650e4c6?ds=inline Change sort ordering in admin, give more full path to item --- diff --git a/sommitrealweird/bpcms/models.py b/sommitrealweird/bpcms/models.py index ca3eb06..f28fede 100644 --- a/sommitrealweird/bpcms/models.py +++ b/sommitrealweird/bpcms/models.py @@ -29,11 +29,14 @@ class Document(models.Model): slug = models.SlugField() content = models.TextField() + class Meta: + ordering = ["folder"] + def __str__(self): return self.__unicode__() def __unicode__(self): - return u'%s (%s)' %(self.title, self.slug) + return u'%s (%s)' %(self.title, self.get_folder_path()) def save(self): super(Document, self).save() @@ -89,11 +92,11 @@ class Folder(models.Model): while curfolder != None: folders.append(curfolder.slug) curfolder = curfolder.parent - + folders.reverse() folderstring = "/".join(folders) return folderstring - + def save(self, force_insert=False, force_update=False): super(Folder, self).save(force_insert, force_update) if self.parent == None: