]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blobdiff - sommitrealweird/bpcms/models.py
Make h1 tags of templates not have a preceeding space.
[sommitrealweird.git] / sommitrealweird / bpcms / models.py
index f538421613dd453f43f6dd038a6663f9edca7978..ad88e4ab14d2de1654db30c83b1540035f7fd73e 100644 (file)
@@ -1,5 +1,6 @@
 from django.db import models
-from bpcms.content_val import is_unique_name
+from bpcms.content_val import is_allowed_name
+from django.conf import settings
 
 FORMAT_CHOICES = (
         ('rst', 'reStructuredText'),
@@ -11,7 +12,7 @@ class Document(models.Model):
     islive = models.BooleanField()
     folder = models.ForeignKey('Folder', null=True, blank=True)
     format = models.CharField(maxlength=10, choices=FORMAT_CHOICES)
-    slug = models.SlugField(prepopulate_from=("title",), validator_list=[is_unique_name,])
+    slug = models.SlugField(prepopulate_from=("title",), validator_list=[is_allowed_name,])
     content = models.TextField()
 
     def __str__(self):
@@ -44,14 +45,14 @@ class Document(models.Model):
         if folderstring != u'':
             folderstring = "%s/" %(folderstring,)
 
-        return "%s%s/" %(folderstring, self.slug)
+        return "%s%s%s/" %(settings.BPCMS_ROOT, folderstring, self.slug)
 
     class Admin:
         pass
 
 class Folder(models.Model):
     title = models.CharField(maxlength=150)
-    slug = models.SlugField(prepopulate_from=("title",))
+    slug = models.SlugField(prepopulate_from=("title",), validator_list=[is_allowed_name,])
     parent = models.ForeignKey('self', null=True, blank=True)
 
     def __str__(self):
@@ -72,7 +73,7 @@ class Folder(models.Model):
         if folderstring != u'':
             folderstring = "%s/" %(folderstring,)
 
-        return "%s" %(folderstring)
+        return "%s%s" %(settings.BPCMS_ROOT, folderstring)
 
     class Admin:
         pass