Django provides base view classes which will suit a wide range of applications. All views inherit from the View class, which handles linking the view in to the URLs, HTTP method dispatching and other simple features. RedirectView is for a simple HTTP redirect, and TemplateView extends the base class to make it also render a template.
Renders a given template, with the context containing parameters captured in the URL.
A page representing a list of objects.Use it when you want to represent multiple objects from your database on a list (single template with multiple objects -- e.g. a list of products that are available in the shop or list of to-dos...).
While this view is executing, self.object will contain the object that the view is operating upon.Use it when you want to represent single object from your database (single template with one object, detailed -- e.g. product page).
You can add context by overriding get_context() method.
(context = super().get_context(); context['type'] = list; return context).
{% if type == list %}
<p>This is a list</p>
{% elif type == template %}
<p>This is just a template</p>
...
Or just e.g. context['list'] == True
And then:
{% if list %}
<p>This is a list</p>
{% if template %}
<p>This is just a template</p>
...