8.2.3 Redisplaying Bound Form Values in tag_form.html

We currently display errors in our TagForm, which is a strong first step for usability, but we are not currently providing field values. If a user fills in our form with invalid data and submits it, the bound form the site displays does not provide the values the user submitted. Concretely, if the user provides the name and slug fields with Creation and create, the form will return, informing the user that the slug field may not be “create,” but both the name and slug fields will be empty, requiring the user to retype the entire form. Screenshots of this behavior are provided in Figure 8.1.

Figure 8.1: Behavior without Redisplay

Bound form values are available in the template Context

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.