November 2015
Beginner to intermediate
840 pages
26h 30m
English
A CBV can do everything a function view can do. We’ve not seen the use of the URL pattern dictionary previously, and so we’ll now take the opportunity to use a dictionary in both a function view and a CBV to demonstrate similarities. The practical purpose of our dictionary is to override the base template of our view (which we defined in Chapter 4 in the template as parent_template), and the learning purpose is to familiarize you with the URL pattern dictionary and CBVs.
To start, we add the dictionary to both blog URL patterns, as shown in Example 5.59.
Example 5.59: Project Code
5 urlpatterns = [ 6 url(r'^$', 7 PostList ...
Read now
Unlock full access