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 = FormSchema.objects.get(pk=self.kwargs["form_pk"]) ctx["form_schema"] = form_schema return ctx
Look at the form detail page again. This time, the heading should reflect the form title, as shown in the following screenshot...