]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blobdiff - sommitrealweird/bpcms/models.py
Initial port to django-1.7
[sommitrealweird.git] / sommitrealweird / bpcms / models.py
index ca3eb06a380326a3cda7142f9f0b9e2300cf3359..38f18ffe47b400d68327ebcf73535d3fbb0130cd 100644 (file)
@@ -22,18 +22,21 @@ class CSSDocument(models.Model):
 
 class Document(models.Model):
     title = models.CharField(max_length=150)
-    islive = models.BooleanField()
+    islive = models.BooleanField(default=False)
     extracss = models.ManyToManyField(CSSDocument, null=True, blank=True)
     folder = models.ForeignKey('Folder', null=True, blank=True)
     format = models.CharField(max_length=10, choices=FORMAT_CHOICES)
     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.get_basic_url(), self.title)
 
     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: