How it works...

You might know about formsets from the Django model administration. Formsets are used there in the mechanism of inlines for child models having foreign keys to a parent model.

In this recipe, we added formsets to the idea form using django-crispy-forms. The result will look like this:

As you can see, we can insert the formsets not necessarily at the end of the form, but anywhere in between, where it makes sense. In our example, it makes sense to list out translations just after translatable fields.

The form layout for the translations forms has the main fieldset just like the layout of IdeaForm, but in addition, it has id

Get Django 3 Web Development Cookbook - Fourth Edition 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.