Re: context processor question

2007-07-19 Thread yml

Hello,

Here it is the part of the documentation you are looking for:
http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext
This is an extract of the part that you are looking:
If you're using Django's render_to_response() shortcut to populate
a template with the contents of a dictionary, your template will be
passed a Context instance by default (not a RequestContext). To use a
RequestContext in your template rendering, pass an optional third
argument to render_to_response(): a RequestContext instance. Your code
might look like this:

def some_view(request):
# ...
return render_to_response('my_template.html',
  my_data_dictionary,
 
context_instance=RequestContext(request))

I hope that help.


On Jul 19, 6:45 am, james_027 <[EMAIL PROTECTED]> wrote:
> Hi Jeremy,
>
> I am a bit lost ... where do I apply that? Isn't that I just call the
> variable name/dict key in the template?
>
> Thanks
> james
>
> On Jul 19, 11:18 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
>
> > On 7/18/07, james_027 <[EMAIL PROTECTED]> wrote:
> > ...
>
> > > the commonly use data will automatically available, do I get it right?
>
> > Yes.  Just keep in mind that you need to use RequestContext rather
> > than Context in order for context processors to be applied.


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



Re: context processor question

2007-07-18 Thread james_027

Hi Jeremy,

I am a bit lost ... where do I apply that? Isn't that I just call the
variable name/dict key in the template?

Thanks
james

On Jul 19, 11:18 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 7/18/07, james_027 <[EMAIL PROTECTED]> wrote:
> ...
>
> > the commonly use data will automatically available, do I get it right?
>
> Yes.  Just keep in mind that you need to use RequestContext rather
> than Context in order for context processors to be applied.


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



Re: context processor question

2007-07-18 Thread Jeremy Dunck

On 7/18/07, james_027 <[EMAIL PROTECTED]> wrote:
...
> the commonly use data will automatically available, do I get it right?
>


Yes.  Just keep in mind that you need to use RequestContext rather
than Context in order for context processors to be applied.

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



context processor question

2007-07-18 Thread james_027

Hi,

As I understand context are data we can use in our templates, and the
purpose of context processor is instead of doing something like

c = Context({
'latest_poll_list': latest_poll_list,
})

or

return render_to_response('polls/index.html', {'latest_poll_list':
latest_poll_list})

the commonly use data will automatically available, do I get it right?

Thanks
james


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