Hello,

I had similar problem, what I couldn't access user object in
templates. Now I have to solutions, and both of them are annoying.

First always pass a user to template:
render_to_response("some_template.html", {'user':request.user})

Second always set context_instance to RequestContext:
render_to_response("some_template.html", {},
context_instance=RequestContext(request))

Annoying thing, that I can't forget to do it in one way, and also I
have to repeat on all views responses...
Is there anyway, to avoid these repeating all the time? For example,
maybe it is possible to set context_instance to RequestContext?

Cheers,
Rapolas K.


On Apr 15, 2:55 pm, Gil Sousa <[email protected]> wrote:
> Thanks a lot :)
>
> It works now :)
>
> On 15 Abr, 13:58, Daniel Roseman <[email protected]>
> wrote:
>
>
>
> > On Apr 15, 11:56 am, Gil Sousa <[email protected]> wrote:
>
> > > I am new with django, sorry about this kind of questions.
>
> > > I don't know how to pass the 'user' variable into thetemplate, how
> > > can I do that?
>
> > > Thanks for your help!
>
> > The same way you pass all the other variables when you render the
> >template.
>
> > Or, as I said above, use the context processors - I meant to include
> > the link:http://docs.djangoproject.com/en/dev/ref/templates/api/#id1
> > --
> > 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