November 2015
Beginner to intermediate
840 pages
26h 30m
English
Django supplies a GCBV called DetailView that does everything our own GCBV does and more. We can thus delete our implementation in /organizer/utils.py and replace the import in /organizer/views.py, as shown in Example 17.19.
Example 17.19: Project Code
organizer/views.py in d6268eb17b
7 from django.views.generic import DetailView, View
The DetailView we built was modeled heavily off of Django’s own. The Django GCBV accepts all of the attributes we used (context_object_name, model, template_name and template_name_suffix) and contains all of the methods we built (get(), get_context_data(), get_context_object_name(), get_object(), get_template_names()). We therefore don’t need to ...
Read now
Unlock full access