Hi did you notice in tutorial (or docs) that view names in urls.py are usually strings, not functions? So, if you use 'farewell' in urls.py, you should be fine.
HTH Jirka On 22/04/2011, Marg Wilkinson <marg2.wilkin...@gmail.com> wrote: > Hi, > > I'm a total newbie slogging my way through a tutorial. I've reached an > impasse with logging off > > In views my code includes > > -------------------------------------------------------- > from django.contrib.auth import logout > > def farewell(request): > logout(request) > return HttpResponseRedirect('/') > ------------------------------------------------------- > > and urls.py has the lines > > ------------------------------------------------- > urlpatterns = patterns('', > url(r'^admin/', include(admin.site.urls)), > url(r'^$', main_page), > url(r'^user/(\w+)/$', user_page), > url(r'^login/$', 'django.contrib.auth.views.login', > {'template_name': 'registration/login.html'}), > url(r'^logout/$',farewell), > ---------------------------------------------------- > > > http://127.0.0.1:8000/farewell (or anything after the 8000/) gives > me an error > ----------------------------------------------------- > Exception Value: > > name 'farewell' is not defined > -------------------------------------------------------- > > OK but farewell looks defined to me in views.py, so what am I > missing? > > (BTW - originally I was trying to use logout for my def instead of > farewell, with appropriate urls.py changes - same error except it > specified that "logout" was not defined.) > > Can anyone please point a newbie in the right direction? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.