]> git.sommitrealweird.co.uk Git - sommitrealweird.git/commitdiff
Change sort ordering in admin, give more full path to item
authorBrett Parker <iDunno@sommitrealweird.co.uk>
Wed, 3 Mar 2010 09:15:02 +0000 (09:15 +0000)
committerBrett Parker <iDunno@sommitrealweird.co.uk>
Wed, 3 Mar 2010 09:15:02 +0000 (09:15 +0000)
sommitrealweird/bpcms/models.py

index ca3eb06a380326a3cda7142f9f0b9e2300cf3359..f28fedefd647edd1eab874a8359d8d30929e60b4 100644 (file)
@@ -29,11 +29,14 @@ class Document(models.Model):
     slug = models.SlugField()
     content = models.TextField()
 
     slug = models.SlugField()
     content = models.TextField()
 
+    class Meta:
+        ordering = ["folder"]
+
     def __str__(self):
         return self.__unicode__()
 
     def __unicode__(self):
     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()
 
     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
         while curfolder != None:
             folders.append(curfolder.slug)
             curfolder = curfolder.parent
-        
+
         folders.reverse()
         folderstring = "/".join(folders)
         return folderstring
         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:
     def save(self, force_insert=False, force_update=False):
         super(Folder, self).save(force_insert, force_update)
         if self.parent == None: