November 2015
Beginner to intermediate
840 pages
26h 30m
English
Our templates for displaying forms are nearly identical. We have oodles of duplicate code, in violation of DRY and common sense, and it may seem like a very good idea to create a template at the site-level to inherit from in all of these templates. Do not do it—it’s a trap.
The recommended structure for templates is what we have at the moment, and is most easily visualized as in Figure 8.3.
Figure 8.3: Current Template Inheritance
If we were to add a base_form.html template, we would be duplicating the structure above, but only for templates, as shown in Figure 8.4.
Figure 8.4: Form Template Inheritance ...
Read now
Unlock full access