invalid syntax (urls.py, line 10)

216 views
Skip to first unread message

MikeKJ

unread,
Dec 12, 2013, 8:33:47 AM12/12/13
to django...@googlegroups.com

Warning: This is a port from 0.97 to 1.3.7 (thanks DR)

The front end of the site is working just the admin is being difficult

SyntaxError at /admin/honorary/member/

invalid syntax (urls.py, line 10)
location
/home/paston2/webapps/sevenkbw/lib/python2.7/django/utils/importlib.py in import_module, line 35

requested url http://7kbw.paston2.webfactional.com/admin/honorary/member/

looking at the traceback and the local vars within it appears that the admin is having a problem with sitename.urls
this is the urls.py


from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^r/', include('django.conf.urls.shortcut')),
(r'^admin/', include(admin.site.urls)),
(r'^admin/auth/user/(?P<user_id>\d+)/activate/$','userprofile.admin-views.activate_user', name="user_activate"),
(r'^admin/userprofile/csv_export/','userprofile.admin-views.csv_export',name="csv_export"),
(r'^admin/userprofile/userprofile/add/','userprofile.admin-views.add_user',name="admin_add_user"),
(r'^admin/articles/article/add/$', 'articles.views.add_article'),
(r'^admin/articles/article/(?P<id>\d+)/$','articles.views.change_article'),
(r'^admin/cvmailer/$', 'barristers.views.cv_mailer'),
(r'^accessibility/', include('accessibility.urls')),
(r'^contact-us/', include('contact.urls')),
(r'^news/', include('news.urls')),
(r'^links/', include('links.urls')),
(r'^barristers/', include('barristers.urls')),
(r'^what-the-directories-say/$', 'quotes.views.quote_list'),
(r'^quotes/(?P<directory_slug>.+)/(?P<category_pk>\d+)/$','quotes.views.quote_list'),
(r'^quotes/(?P<directory_slug>.+)/$','quotes.views.quote_list'),
(r'^practice-areas/(?P<practicearea>.*)/$', 'barristers.views.index'),
(r'^sesttectors/(?P<practicearea>.*)/$', 'barristers.views.practicearea'),
(r'^training/', include('training.urls')),
(r'^servecv/(?P<slug>.*)/$', 'barristers.views.serve_cv_for_pdf'),
(r'^sendmyshortlist/$', 'barristers.views.mailshortlist'),
(r'^accounts/', include('userprofile.urls')),
#(r'^rss/', include('feeds.urls')),
(r'^articles/$', 'news.views.article_list'),
(r'^article/(?P<news_id>\d+)/$', 'news.views.article'),
(r'^articles/archive/$', 'news.views.article_archive'),
(r'^cases/$', 'news.views.case_list'),
(r'^cases/(?P<practicearea_slug>.*)/$', 'news.views.case_list'),
(r'^case/(?P<news_id>\d+)/$', 'news.views.case'),
(r'^expertise/(?P<practicearea_slug>.*)/$', 'barristers.views.expertise'),
(r'^search/', 'search.views.do_search'),
(r'^honorary/pdf/(?P<id>\d+)/$', 'honorary.views.render_to_pdf'),
(r'^honorary/(?P<id>\d+)/$', 'honorary.views.honorary_member'),
(r'^user/', include('sevenkbw.userprofile.urls')),
(r'^', include('smartpages.urls')),
)


Daniel Roseman

unread,
Dec 12, 2013, 8:37:38 AM12/12/13
to django...@googlegroups.com
On Thursday, 12 December 2013 13:33:47 UTC, MikeKJ wrote:

Warning: This is a port from 0.97 to 1.3.7 (thanks DR)

The front end of the site is working just the admin is being difficult

SyntaxError at /admin/honorary/member/

invalid syntax (urls.py, line 10)
location
/home/paston2/webapps/sevenkbw/lib/python2.7/django/utils/importlib.py in import_module, line 35

requested url http://7kbw.paston2.webfactional.com/admin/honorary/member/

looking at the traceback and the local vars within it appears that the admin is having a problem with sitename.urls
this is the urls.py


<snip>

Here is line 10:

    (r'^admin/auth/user/(?P<user_id>\d+)/activate/$','userprofile.admin-views.activate_user', name="user_activate"), 

In order to use the `name` kwarg you need to make this URL a call to the `url()` function:

    url(r'^admin/auth/user/(?P<user_id>\d+)/activate/$','userprofile.admin-views.activate_user', name="user_activate"), 

The same is true for the other lines where you use `name`.
--
DR.

MikeKJ

unread,
Dec 12, 2013, 8:56:06 AM12/12/13
to django...@googlegroups.com
Cheers DR,

Moving on I think there are Klingons now.....

TemplateSyntaxError at /admin/honorary/member/


Exception Type: TemplateSyntaxError
Exception Value:
Caught TypeError while rendering: __init__() got an unexpected keyword argument 'core'
Exception Location: /home/paston2/webapps/sevenkbw/lib/python2.7/django/db/models/fields/__init__.py in __init__, line 545

I removed all mention of core=True along with edit_inline=True, I just deleted __init__.py and reentered it but no change
Reply all
Reply to author
Forward
0 new messages