November 2015
Beginner to intermediate
840 pages
26h 30m
English
All of the HTML forms to create or update objects that we created in this book followed a formula. Instead of constantly building these forms, it would have been far simpler for us to create an inclusion tag to display the form with certain parameters.
In our core app, we create the templatetags directory and a display_form.py file. In it, we import our tools and create the template library, as shown in Example 27.27.
Example 27.27: Project Code
core/templatetags/display_form.py in 95d56b7b4f
1 from django.core.exceptions import \ 2 ImproperlyConfigured 3 from django.core.urlresolvers import reverse 4 from django.template import ( 5 Library, TemplateSyntaxError) ...
Read now
Unlock full access