]> git.sommitrealweird.co.uk Git - sommitrealweird.git/commitdiff
rename 'content' to 'bpcms'
authorBrett Parker <iDunno@sommitrealweird.co.uk>
Sat, 2 Feb 2008 15:08:27 +0000 (15:08 +0000)
committerBrett Parker <iDunno@sommitrealweird.co.uk>
Sat, 2 Feb 2008 15:08:27 +0000 (15:08 +0000)
sommitrealweird/bpcms/__init__.py [moved from sommitrealweird/content/__init__.py with 100% similarity]
sommitrealweird/bpcms/content_val.py [moved from sommitrealweird/content/content_val.py with 68% similarity]
sommitrealweird/bpcms/context_processors.py [moved from sommitrealweird/content/context_processors.py with 71% similarity]
sommitrealweird/bpcms/models.py [moved from sommitrealweird/content/models.py with 96% similarity]
sommitrealweird/bpcms/templates/bpcms/html.html [moved from sommitrealweird/content/templates/html.html with 100% similarity]
sommitrealweird/bpcms/templates/bpcms/rst.html [moved from sommitrealweird/content/templates/rst.html with 100% similarity]
sommitrealweird/bpcms/views.py [moved from sommitrealweird/content/views.py with 95% similarity]

similarity index 68%
rename from sommitrealweird/content/content_val.py
rename to sommitrealweird/bpcms/content_val.py
index a7ba5827c43b2e0ced9678c3be8a7b2c0dee05b2..0e621503cb6988eb7f7df7b963c8ba03e7c33262 100644 (file)
@@ -1,17 +1,17 @@
 from django.core import validators
 
 def is_unique_name(slug, all_data):
-    from content.models import Document, Folder
+    from bpcms.models import Document, Folder
     if all_data["folder"] != '' and all_data["id"] == '':
         folder_id = int(all_data["folder"])
         try:
-            doc = Document.object.get(folder__exact=folder_id, slug__exact=slug)
+            doc = Document.objects.get(folder__exact=folder_id, slug__exact=slug)
             raise validators.ValidationError(u'There is already a document with that name')
         except:
             pass
 
         try:
-            folder = Folder.object.get(slug__exact=slug, parent__exact=folder_id)
+            folder = Folder.objects.get(slug__exact=slug, parent__exact=folder_id)
             raise validators.ValidationError(u'There is already a folder with that name')
         except:
             pass
similarity index 71%
rename from sommitrealweird/content/context_processors.py
rename to sommitrealweird/bpcms/context_processors.py
index 33f7905000a3f8cef9c5c95c0b23fbec0cf03a1b..90b98cc902abe87be74ce7c1e05e4da2353666fc 100644 (file)
@@ -1,4 +1,4 @@
-from content.models import Document, Folder
+from bpcms.models import Document, Folder
 import operator
 
 def content_menu(request):
@@ -12,21 +12,22 @@ def content_menu(request):
                     'url': item.get_basic_url(),
                 }
             )
-    folders = Folder.objects.filter(folder__isnull=True)
+    folders = Folder.objects.filter(parent__isnull=True)
     for folder in folders:
         try:
-            item = Document.objects.filter(folder__exact=folder, islive__exact=True, slug__exact='index')
+            items = Document.objects.filter(folder__exact=folder, islive__exact=True, slug__exact='index')
+            item = items[0]
             menu_items.append(
                 {
-                    'title': folder.title,
+                    'title': item.title,
                     'url': folder.get_basic_url(),
                 }
             )
         except:
             pass
-    
+
     menu_items.sort(cmp=lambda x,y: cmp(x['title'].lower(), y['title'].lower()))
-    
+
     return {
         'content_menu': menu_items,
     }
similarity index 96%
rename from sommitrealweird/content/models.py
rename to sommitrealweird/bpcms/models.py
index a310a79a25c0f5bc6e4ea747a8c494b8f2a9ab7a..f538421613dd453f43f6dd038a6663f9edca7978 100644 (file)
@@ -1,5 +1,5 @@
 from django.db import models
-from content.content_val import is_unique_name
+from bpcms.content_val import is_unique_name
 
 FORMAT_CHOICES = (
         ('rst', 'reStructuredText'),
@@ -72,7 +72,7 @@ class Folder(models.Model):
         if folderstring != u'':
             folderstring = "%s/" %(folderstring,)
 
-        return "%s/" %(folderstring)
+        return "%s" %(folderstring)
 
     class Admin:
         pass
similarity index 95%
rename from sommitrealweird/content/views.py
rename to sommitrealweird/bpcms/views.py
index 423e44fa51ed1b0f7b21477a1b56aef9d0fe5b12..d98fa8cf5e1ec2cc6c6ed5846bd1a2aa7ae7dc2c 100644 (file)
@@ -1,4 +1,4 @@
-from content.models import Document, Folder
+from bpcms.models import Document, Folder
 from django.http import Http404, HttpResponse
 from django.template import RequestContext, loader
 
@@ -43,7 +43,7 @@ def document_view(request, slug=None, folders=None):
                 doc = Document.objects.get(slug__exact='index', islive__exact=True, folder__exact=folder)
             except:
                 raise Http404
-    template_name = "%s.html" %(doc.format,)
+    template_name = "bpcms/%s.html" %(doc.format,)
     t = loader.get_template(template_name)
     c = RequestContext(request,
         {