Take the 2-minute tour ×

In django/contrib/auth/views.py there is the definition of the logout view :

def logout(request, next_page=None,
       current_app=None, extra_context=None):

I would like to add extra_context to get rid of the 'Logged out' title that appear when I log off

so I'm trying this in my url confs :

(r'^accounts/logout/$', logout(extra_context={'title':'something else'}) ),

but then I get this error : logout() takes at least 1 non-keyword argument (0 given) what I'm doing wrong? ps: when I do


it works, but then I get the 'Logged out' text...

Thanks, Fred

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

When you write logout(extra_context={'title':'something else'}), you're actually calling logout right there in the URLconf, which won't work. Any URLconf tuple can have an optional third element, which should be a dictionary of extra keyword arguments to pass to the view function.

(r'^accounts/logout/$', logout, {'extra_context':{'title':'something else'}}),

Alternatively, you could write your own view which calls logout passing in whatever arguments you want -- that's typically how you would "extend" function-based generic views in more complicated cases.

share|improve this answer
add comment

Your Answer


