Monday, March 14, 2011

Re: Difference between RequestContext and Context?

On Mon, Mar 14, 2011 at 8:16 AM, gamingdroid <gamingdroid@gmail.com> wrote:
> 1. So beyond the fact that RequestContext can accept a dictionary with
> values to be included in the Context, what is the difference between
> RequestContext and Context?
>
> I tried reviewing the source code, but it still isn't really clear
> (i.e. meaning I didn't quite understand the source code).
>
> 2. Why is it that Context automatically loads some context processors
> while RequestContext does NOT?
>
> At least it almost seem like it, because when I tried to use
> RequestContext, I had to include
> ''django.contrib.auth.context_processors.auth'' in the
> TEMPLATE_CONTEXT_PROCESSOR variable in settings.py for the admin site
> to work, but did not when just using the standard Context.
>

Context doesn't 'load' (execute) any context processors. All context
processors are callables that take a request as their only argument,
this alone should convince you that a standard Context doesn't call
any context processors.

As for the differences between Context and RequestContext, the docs
are quite clear:

http://docs.djangoproject.com/en/1.2/ref/templates/api/#subclassing-context-requestcontext


Cheers

Tom

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate