1 2 3 4 5 6 7 8 | from django.shortcuts import render_to_response
from django.utils.datastructures import MultiValueDict
def direct_to_template(request, template, **kwargs):
params = MultiValueDict()
params.update(kwargs)
params.update(request.GET)
return render_to_response(template % kwargs, params)
|
More like this
- direct to template from a subdir by Scanner 3 years, 7 months ago
- Allow any view (probably a generic view) to accept captured URL variables into extra_context. by orblivion 1 year, 7 months ago
- Automatic CRUD urls from your models... by codigodaniel 1 year, 4 months ago
- Allow any view (probably a generic view) to accept POST variables into extra_context by orblivion 1 year, 7 months ago
- Django 1.2+ template loader for Jinja2 by SimonSapin 1 year, 11 months ago
Comments
Pretty neat!
Unless you need to pass the template name to your context, you could also just do:
#