about tutorial

306 views
Skip to first unread message

Alan

unread,
Dec 3, 2008, 7:22:36 AM12/3/08
to Django users
Hi, so I did the tutorial and did a simple modification in order to
get 'polls' views and 'admin' view too but I am failing.

It's that:

for mysite/urls.py:
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/(.*)', admin.site.root),
(r'^polls/', include('mysite.polls.urls')),
)

But, if so, then admin pages failed (http://localhost:8000/admin/):
TemplateSyntaxError at /admin/
Caught an exception while rendering: Tried vote in module
mysite.polls.views. Error was: 'module' object has no attribute 'vote'
...

If I want 'admin' view, then I have to comment out line "(r'^polls/',
include('mysite.polls.urls')),"

Well, I must confess that my knowledge on regexp is limited. So, in
the end, what should I do about mysite/urls.py in order to get both
admin and polls pages working?

Many thanks in advance,

Alan

bruno desthuilliers

unread,
Dec 3, 2008, 10:24:58 AM12/3/08
to Django users
On 3 déc, 13:22, Alan <alanwil...@gmail.com> wrote:
> Hi, so I did the tutorial and did a simple modification in order to
> get 'polls' views and 'admin' view too but I am failing.
>
> It's that:
>
> for mysite/urls.py:
> from django.conf.urls.defaults import *
> from django.contrib import admin
> admin.autodiscover()
> urlpatterns = patterns('',
> (r'^admin/(.*)', admin.site.root),
> (r'^polls/', include('mysite.polls.urls')),
> )
>
> But, if so, then admin pages failed (http://localhost:8000/admin/):
> TemplateSyntaxError at /admin/
> Caught an exception while rendering: Tried vote in module
> mysite.polls.views. Error was: 'module' object has no attribute 'vote'
> ...
>
> If I want 'admin' view, then I have to comment out line "(r'^polls/',
> include('mysite.polls.urls')),"

I strongly suspect an error in either your polls.urls module or your
polls.views module. It seems you're trying to access some unexisting
symbol of the polls.views module (a view function perhaps ?) named
'vote'.

> Well, I must confess that my knowledge on regexp is limited. So, in
> the end, what should I do about mysite/urls.py in order to get both
> admin and polls pages working?

first make sure the whole thing works correctly without the admin
part.

Alan

unread,
Dec 3, 2008, 10:49:30 AM12/3/08
to django...@googlegroups.com
In fact I found the problem. If I had finished part 4 of the tutorial I would have any issue. Method 'vote' is created there and now everything works fine.

Sorry for being hurry.

Cheers,
Alan
--
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<
Reply all
Reply to author
Forward
0 new messages