O'Reilly logo

Django Unleashed by Andrew Pinkham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

27.3.2 Displaying Create and Update Forms

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) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required