Monday, January 3, 2011

Re: Contact form doesn't see user as logged in

On Tue, 2011-01-04 at 08:38 +0100, Łukasz Rekucki wrote:
> How do you check that user is logged in ? If it's via request.user,
> then it doesn't work 'cause you
> aren't passing the request object to your template's context. The
> recomended way to do this is using RequestContext:
>
> from django.template import RequestContext
>
> return render_to_response('forms/contact.html', {'form': form},
> context_instance=RequestContext(request))

and add the context processor:
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request',
)


--
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment