Views

NDR Core provides a number of configured views to choose from. Normally you don’t have to implement them manually but can do so over the administration-interface.

This file contains the main NDR Core views. All Page views are defined here. For the views for the administration interface, see admin_views/*

class ndr_core.views.AboutUsView(**kwargs)

A view to show an about us page.

get(request, *args, **kwargs)

Default get method for all ndr core pages.

get_context_data(**kwargs)

Returns the context data for this view.

class ndr_core.views.ContactView(**kwargs)

A view to show a contact form

form_class

alias of ContactForm

form_invalid(form)

If the form is invalid, render the invalid form.

form_valid(form)

If the form is valid, save the associated model.

get_context_data(**kwargs)

Insert the form into the context dict.

model

alias of NdrCoreUserMessage

success_url
class ndr_core.views.DataListView(**kwargs)

A view to display a paginated list of all items from a search configuration. Uses compact result cards for list items, detailed cards for detail view, and simple search fields for filters.

form_class

alias of DataListSearchForm

get(request, *args, **kwargs)

Display paginated list with optional filters.

class ndr_core.views.FlipBookView(**kwargs)

A view to show a set of pages with ‘back’ and ‘forward’ buttons.

get_context_data(**kwargs)

Returns the context data for this view.

class ndr_core.views.NdrCSVListDownloadView

Returns a CSV record list from a search result.

get(request, *args, **kwargs)

Returns a CSV record list from a search result.

class ndr_core.views.NdrDownloadView(**kwargs)

Returns a JSON record from an ID request to the API

get(request, *args, **kwargs)

Default get method for all ndr core pages.

class ndr_core.views.NdrListDownloadView

Returns a JSON record list from a search result.

create_result_for_response()

Creates a result object for the response.

get(request, *args, **kwargs)

Default get method for all ndr core pages.

class ndr_core.views.NdrMarkForCorrectionView(**kwargs)

Marks a record for correction.

get(request, *args, **kwargs)

Marks a record for correction.

class ndr_core.views.NdrTemplateView(**kwargs)

Basic template view.

class ndr_core.views.SearchView(**kwargs)

A view to search for records in the configured API.

build_search_explanation(form, requested_search, search_config)

Build a human-readable explanation of what was searched for.

get(request, *args, **kwargs)

A view to search for records in the configured API.

ndr_core.views.create_robots_txt_view(request, as_string=False)

Create a robots.txt file.

ndr_core.views.create_sitemap_view(request, as_string=False)

Create a sitemap.xml file.

ndr_core.views.dispatch(request, ndr_page=None)

All requests for ndr_core pages are routed through this function which decides the type of page which should be returned based on the configuration. If the ndr_page is None, the index page is returned.

Parameters:
  • request – The page’s request object

  • ndr_page – The NdrCorePage’s database id

Returns:

A configured view or 404 if not found

ndr_core.views.display_schema_or_404(request, schema_name)

Displays a schema or 404.

ndr_core.views.get_page_type_view_class(page_type)

Returns the view class for a given page type.

ndr_core.views.google_search_console_verification_view(request, verification_file)

Returns a Google Search Console verification file.

ndr_core.views.manifest_url_view(request, manifest_id)

Returns a manifest URL.

ndr_core.views.return_static_html(request)

Returns a static HTML page.

ndr_core.views.set_language_view(request, new_language)

A view to set the language of the page.