O'Reilly logo

Django Project Blueprints by Asad Jibran Ahmed

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

Small fixes

I noticed three small errors while working on this last section that I'd like to fix. First of all, if you take a closer look at the form submission page (where the user can enter data in a custom form), you'll notice that the heading on the top says Custom Form. This is from our first test, when our form schema was defined in a hardcoded JSON string and didn't have a title. As our form model now has a title field, edit main/templates/custom_form.html and change the h1 tag to match the following:

<h1>{{ form_schema.title }}</h1>

Next, edit CustomFormView in main/views.py and add the this get_context_data method to the class:

def get_context_data(self, **kwargs): ctx = super(CustomFormView, self).get_context_data(**kwargs) form_schema ...

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