On Jun 14, 8:55 am, Sithembewena Lloyd Dube <[email protected]> wrote:
> Hi all,
>
> I am using Django 1.2 to write the Django tutorial poll app. At the end of
> my *vote* view, I have the following line of code:
> *
> return 
> HttpResponseRedirect(reverse(myproject.polls.views.results(args=(p.id,))))
> *
>
> When I navigate tohttp://127.0.0.1:8000/polls/1/vote/, I am able to vote,
> but during the redirect to the results page of that poll, I get an exception
> as follows:
>
> *"global name 'myproject' is not defined"*
>
> I discovered that I can get around this by importing my project, but somehow
> that feels wrong - and the tutorial explicitly says to use the full name of
> the view including the prefix as an argument to the reverse() function.
>
> What could be wrong?
>
> Thanks

You have not done what the tutorial says. It says to use the full
**name** of the function. For some reason, you are trying to *call*
the function and pass the parameters. That will end up passing the
output of the function to reverse(), which is certainly not what you
want.

Instead, do what the tutorial says:
return HttpResponseRedirect(reverse("myproject.polls.views.results",
args=(p.id,)))
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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/django-users?hl=en.

Reply via email to