Is it possible to pass some argument from dynamic urls
(I have ^c/(?P<username>\w+)/^
) to custom context_processors
?
views.py (I pass username
from url to RequestContext
)
def client_profile(request, username):
# .... some context
return render_to_response('profile.html', context,
context_instance=RequestContext(request, username))
context_processors.py
def default_profile(request, username):
client = get_object_or_404(Client, user__username=username)
#.... some default
return {
'client': client,
#.... some default
}
I try this, but it was an error when I reload a page
default_profile() missing 1 required positional argument: 'username'
Is any another way to do something like this? Or is it really not possible?
-Thanks.