]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blobdiff - sommitrealweird/bpcms/models.py
Change sort ordering in admin, give more full path to item
[sommitrealweird.git] / sommitrealweird / bpcms / models.py
index ca3eb06a380326a3cda7142f9f0b9e2300cf3359..f28fedefd647edd1eab874a8359d8d30929e60b4 100644 (file)
@@ -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: