19π
β
If all of your dynamic content is handled in the template (for example, if itβs just simple checking if a user is present on the request), then I recommend using a generic view, specificially the direct to template view:
urlpatterns = patterns('django.views.generic.simple',
(r'^$', 'direct_to_template', {'template': 'index.html'}),
)
If you want to add a few more bits of information to the template context, there is another argument, extra_context
, that you can pass to the generic view to include it:
extra_context = {
'foo': 'bar',
# etc
}
urlpatterns = patterns('django.views.generic.simple',
(r'^$', 'direct_to_template', {'template': 'index.html', 'extra_context': extra_context }),
)
π€TM.
- [Django]-How to pass django rest framework response to html?
- [Django]-Constructing Django filter queries dynamically with args and kwargs
- [Django]-Django count RawQuerySet
Source:stackexchange.com