Direct to Template


URLconf (urls.py) is the mapping between urls and functions (views.py). When the user click triggers the url the function will be executed, prepares the data (e.g. by fetching from a database) and returns always a HttpResponse object which can use a template. direct_to_template allows to omit the function and directly tell which page to go: ::

nano urls.py
from django.conf.urls.defaults import patterns, url
from django.views.generic.simple import direct_to_template


urlpatterns = patterns('',
    url(^about/$', direct_to_template, {'template': about.html'})
)


Edit post (Admin)

Comment on This Data Unit