August 2016
Beginner to intermediate
717 pages
15h 24m
English
The DetailView CBV allows us to display information from a registration model. This is the first CBV we will study that has URL parameters. In order to view the details of a record, it will send its ID to the CBV. We will study some examples.
First, we will create a page that will display the details of a task. For this, we will create the URL by adding these lines in the urls.py file:
from django.views.generic import DetailView from TasksManager.models import Task url (r'^task_detail_(?P<pk>\d+)$', DetailView.as_view(model=Task, template_name="en/public/task_detail.html"), name="task_detail"),
In this URL, we added the parameter-sending aspect. We have already discussed this type of URL in an earlier ...
Read now
Unlock full access