Author: leidel
Date: Thu Jan 22 12:39:19 2009
New Revision: 296
Modified:
trunk/pages/admin/__init__.py
trunk/pages/admin/forms.py
trunk/pages/admin/widgets.py
trunk/pages/models.py
trunk/pages/settings.py
Log:
Fixed an issue introduced in the last change while looking for
django-tagging
Modified: trunk/pages/admin/__init__.py
==============================================================================
--- trunk/pages/admin/__init__.py (original)
+++ trunk/pages/admin/__init__.py Thu Jan 22 12:39:19 2009
@@ -11,7 +11,7 @@
from django.contrib.admin.util import unquote
from pages import settings
-from pages.models import Page, Content, tagging
+from pages.models import Page, Content
from pages.views import details
from pages.utils import get_template_from_request,
has_page_add_permission, \
get_language_from_request
Modified: trunk/pages/admin/forms.py
==============================================================================
--- trunk/pages/admin/forms.py (original)
+++ trunk/pages/admin/forms.py Thu Jan 22 12:39:19 2009
@@ -3,7 +3,7 @@
from django.utils.translation import ugettext_lazy as _
from pages import settings
-from pages.models import Page, Content, tagging
+from pages.models import Page, Content
class PageForm(forms.ModelForm):
title = forms.CharField(
@@ -27,7 +27,7 @@
choices=settings.PAGE_TEMPLATES,
help_text=_('The template used to render the content.')
)
- if tagging:
+ if settings.PAGE_TAGGING:
from tagging.forms import TagField
from pages.admin.widgets import AutoCompleteTagInput
tags = TagField(widget=AutoCompleteTagInput(), required=False)
Modified: trunk/pages/admin/widgets.py
==============================================================================
--- trunk/pages/admin/widgets.py (original)
+++ trunk/pages/admin/widgets.py Thu Jan 22 12:39:19 2009
@@ -5,10 +5,10 @@
from django.template import RequestContext
from django.template.loader import render_to_string
-from pages.settings import PAGES_MEDIA_URL
-from pages.models import Page, tagging
+from pages.settings import PAGES_MEDIA_URL, PAGE_TAGGING
+from pages.models import Page
-if tagging:
+if PAGE_TAGGING:
from tagging.models import Tag
from django.utils import simplejson
Modified: trunk/pages/models.py
==============================================================================
--- trunk/pages/models.py (original)
+++ trunk/pages/models.py Thu Jan 22 12:39:19 2009
@@ -13,10 +13,6 @@
from pages import settings
from pages.managers import PageManager, ContentManager,
PagePermissionManager
-tagging = "tagging" in settings.INSTALLED_APPS
-if not settings.PAGE_TAGGING:
- tagging = False
-
class Page(models.Model):
"""
A simple hierarchical page model
@@ -44,9 +40,9 @@
# Managers
objects = PageManager()
- if tagging:
- from tagging.fields import TagField
- tags = TagField()
+ if settings.PAGE_TAGGING:
+ from tagging import fields
+ tags = fields.TagField()
class Meta:
verbose_name = _('page')
Modified: trunk/pages/settings.py
==============================================================================
--- trunk/pages/settings.py (original)
+++ trunk/pages/settings.py Thu Jan 22 12:39:19 2009
@@ -22,6 +22,8 @@
# Whether to enable tagging.
PAGE_TAGGING = getattr(settings, 'PAGE_TAGGING', True)
+if PAGE_TAGGING and "tagging" not in getattr(settings, 'INSTALLED_APPS',
[]):
+ raise ImproperlyConfigured("django-tagging could not be found.\nPlease
make sure you've installed it correctly or disable the tagging feature by
setting PAGE_TAGGING to False.")
# Whether to only allow unique slugs.
PAGE_UNIQUE_SLUG_REQUIRED = getattr(settings, 'PAGE_UNIQUE_SLUG_REQUIRED',
True)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---