You can use the django.views.generic.simple "direct_to_template" view
just like you would the render_to_response shortcut - it works the
same except you pass in the request as the first argument:

direct_to_template(request, 'template/index.html')

On Apr 2, 2:42 am, Matias Surdi <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Suppose I've the following on the top of every page of my application
> (in base.html for example):
>
> {% if user.is_authenticated %}
>      <p>Welcome, {{ user.username }}. Thanks for logging in.</p>
> {% else %}
>      <p>Welcome, new user. Please log in.</p>
> {% endif %}
>
> Now, as far as I understand I must ALWAYS do the following in ALL views:
>
> def index(request):
>      render_to_response('template/index.html',{},
>                          context_instance=RequestContext(request))
>
> So, I have to pass always the parameter context_instance to the
> render_to_response shortcut.
>
> ¿Is this correct? Isn't it a bit tedious to do this with all views? What
> if I forget to add the RequestContext thing in a view?
>
> Any aclaration will be appreciated.
>
> Thanksa lot.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to