November 2015
Beginner to intermediate
840 pages
26h 30m
English
In TagUpdate, StartupUpdate, and NewsLinkUpdate, we have set the template_name_suffix attributes to be exactly the same value (and we follow suit with PostUpdate in this chapter).
Setting duplicate attributes to use the same resource violates DRY (Don’t Repeat Yourself) principles and is very easy to avoid. In a new file, core/utils.py, we can create our own UpdateView GCBV, using Django’s own UpdateView GCBV as a base, as shown in Example 18.3.
Example 18.3: Project Code
1 from django.views.generic import \ 2 UpdateView as BaseUpdateView 3 4 5 class UpdateView(BaseUpdateView): 6 template_name_suffix = '_form_update' ...
Read now
Unlock full access