Sunday, February 27, 2011 usage

2. Studying example (CMS) in "Python Web Development with Django.
J.Forcier, P.Bissex, W.Chun" I have got an error:

adding detailes. I study CMS project in Chapter 8 in that book.
Following authors I wrote:
1) project level cmsproject/
from django.contrib import admin
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
# (r'^admin/', include(,
# url(r'^admin/(.*)',,
url(r'^cms/', include('cmsproject.cms.urls')),
# Example:
# Uncomment the admin/doc line below to enable admin
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

2) application level cmsproject/cms/
from django.conf.urls.defaults import *
from cms.models import Story
from cms.models import Category
info_dict = {'queryset': Story.objects.all(), 'template_object_name':
urlpatterns = patterns('cmsproject.cms.views',
url(r'^category/(?P<slug>[-\w]+)/$', 'category', name="cms-
url(r'^search/$', 'search', name="cms-search"),
urlpatterns += patterns('django.views.generic.list_detail',
url(r'^(?P<slug>[-\w]+)/$', 'object_detail', info_dict, name="cms-
url(r'^$', 'object_list', info_dict, name="cms-home"),

error message is: TemplateSyntaxError at /admin/
Caught AlreadyRegistered while rendering: The model Category is
already registered

I also don't understand why cmsproject/cms/ contains = but not
+= in the statement
urlpatterns = patterns...

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment