Generic Templates

Nuit’s generic templates provide the front-end detail for common operations, such as listing objects. These tend to go hand-in-hand with Django’s Generic Views.


Displays a list of objects, linking to their detail URL, with options for pagination and filtering. This is designed to be used with Nuit’s nuit.views.SearchableListView.


The following arguments can be passed to the extend tag to change the behaviour of the list template:


Defines the template which nuit/generic/list.html will extend. This defaults to nuit/base.html, but in most cases you will have made customisations (such as menu items etc.) to your own base template, and need this template to extend your own.


Defines the verb to be displayed on the submit button of the search form, if applicable.


The following blocks can be overridden in subsequent templates to customise the behaviour of the template. All blocks that are included in the template hierarchy are also available - by default, this means all blocks available in nuit/base.html.


As always, the best way to override these blocks is to look at the source code for nuit/generic/list.html. This will give you a good idea about how Nuit implements parts of the template, and therefore a good indication of what is required if you wish to override the blocks.


Defines the title of the page, used in an <h1> element and in the <title>.


Displays above the list of objects when a search has been performed. Defaults to displaying the number of results and the term that was searched for.


Used to override the list of objects. By default, contains an unordered list of the object’s str representations that links to their get_absolute_url.


A generic template designed for display when an HTTP status code of 400 is returned. Used by the nuit.handlers.handler400() handler.


A generic template designed for display when an HTTP status code of 403 is returned. Used by the nuit.handlers.handler403() handler.


A generic template designed for display when an HTTP status code of 404 is returned. Used by the nuit.handlers.handler404() handler.


A generic template designed for display when an HTTP status code of 500 is returned. Used by the nuit.handlers.handler500() handler.


A template designed for use with Django’s django.contrib.auth.login view. Use in your as such:

from django.conf.urls import patterns, include, url

urlpatterns = patterns('',
    url(r'^', include('myapp.urls')),
    url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'nuit/generic/login.html'}),