Re: Access to request from tag
Hi Igor,
If you use django <= 1.2 the you can replace 'render_to_response' with
'direct_to_template'. They do almost the same but 'direct_to_template'
uses RequestContext by default:
from django.views.generic.simple import direct_to_template
def my_view(request):
# ...
return direct_to_template(request, 'my_template.html', {'foo':
'bar'})
In django trunk there are 2 less hacky shortcuts that can help:
http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render
http://docs.djangoproject.com/en/dev/ref/template-response/#using-templateresponse-and-simpletemplateresponse
On 26 дек, 21:52, Igor Artamonov <igor.artamo...@gmail.com> wrote:
> BTW, thank you very much.
>
> I googled a lot, and decided that easiest way is replace all my "Context("
> with "RequestContext(request," and use official way.
> That works :)
--
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