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.
1 from django.core.exceptions import \ 2 ImproperlyConfigured 3 from django.core.urlresolvers import reverse 4 from django.template import ( 5 Library, TemplateSyntaxError) ...