On 5/23/07, Michael Lake <[EMAIL PROTECTED]> wrote:
...
> Oh I'll probably just be doing stuff like:
>
> {% if perms.lab.add_experiment %}
> < a href="something">Click to add experiment.</a>
...
This should work.
> Also I should ask:
> return render_to_response('lab/user.html', data)
>
> was replaced with:
> ctx = RequestContext(request,data)
> return render_to_response('lab/user.html', context_instance=ctx)
>
> But why? What's happening in the later case so why did this fix my problem.
render_to_response is a shortcut that makes some assumptions about the
response you want to send, hence it's placement in django.shortcuts.
I actually don't recommend using shortcuts until you know what you're
missing, but in this case, the "normal" way of calling
render_to_response is as you did:
render_to_response(template_name, context_data)
But this makes assumptions about how you want to load the template
(based on the name), that you want to use a standard
django.template.Context rather than a django.template.RequestContext,
and that the stock HttpResponse, with no overrides, is what you want
to return to the client.
These are often good assumptions, but not in your case.
TEMPLATE_CONTEXT_PROCESSORS don't run on standard Context objects.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---