From 3c8f423203be690dd0bda32e90eec49f1650e4c6 Mon Sep 17 00:00:00 2001 From: Brett Parker Date: Wed, 3 Mar 2010 09:15:02 +0000 Subject: [PATCH] Change sort ordering in admin, give more full path to item --- sommitrealweird/bpcms/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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: -- 2.39.5