From: Brett Parker Date: Sat, 2 Feb 2008 15:08:27 +0000 (+0000) Subject: rename 'content' to 'bpcms' X-Git-Url: https://git.sommitrealweird.co.uk/sommitrealweird.git/commitdiff_plain/56b2cdf3569443cf4504fe085de9db0466dcd09f?ds=inline;hp=a2883504e45a556b06e76f023395e879e01ae03c rename 'content' to 'bpcms' --- diff --git a/sommitrealweird/content/__init__.py b/sommitrealweird/bpcms/__init__.py similarity index 100% rename from sommitrealweird/content/__init__.py rename to sommitrealweird/bpcms/__init__.py diff --git a/sommitrealweird/content/content_val.py b/sommitrealweird/bpcms/content_val.py similarity index 68% rename from sommitrealweird/content/content_val.py rename to sommitrealweird/bpcms/content_val.py index a7ba582..0e62150 100644 --- a/sommitrealweird/content/content_val.py +++ b/sommitrealweird/bpcms/content_val.py @@ -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 diff --git a/sommitrealweird/content/context_processors.py b/sommitrealweird/bpcms/context_processors.py similarity index 71% rename from sommitrealweird/content/context_processors.py rename to sommitrealweird/bpcms/context_processors.py index 33f7905..90b98cc 100644 --- a/sommitrealweird/content/context_processors.py +++ b/sommitrealweird/bpcms/context_processors.py @@ -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, } diff --git a/sommitrealweird/content/models.py b/sommitrealweird/bpcms/models.py similarity index 96% rename from sommitrealweird/content/models.py rename to sommitrealweird/bpcms/models.py index a310a79..f538421 100644 --- a/sommitrealweird/content/models.py +++ b/sommitrealweird/bpcms/models.py @@ -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 diff --git a/sommitrealweird/content/templates/html.html b/sommitrealweird/bpcms/templates/bpcms/html.html similarity index 100% rename from sommitrealweird/content/templates/html.html rename to sommitrealweird/bpcms/templates/bpcms/html.html diff --git a/sommitrealweird/content/templates/rst.html b/sommitrealweird/bpcms/templates/bpcms/rst.html similarity index 100% rename from sommitrealweird/content/templates/rst.html rename to sommitrealweird/bpcms/templates/bpcms/rst.html diff --git a/sommitrealweird/content/views.py b/sommitrealweird/bpcms/views.py similarity index 95% rename from sommitrealweird/content/views.py rename to sommitrealweird/bpcms/views.py index 423e44f..d98fa8c 100644 --- a/sommitrealweird/content/views.py +++ b/sommitrealweird/bpcms/views.py @@ -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, {