How to do it...

Follow these steps:

  1. Let's modify the form layout for IdeaForm:
# myproject/apps/ideas/forms.pyfrom django import formsfrom django.utils.translation import ugettext_lazy as _from django.conf import settingsfrom django.db import modelsfrom crispy_forms import bootstrap, helper, layoutfrom .models import Idea, IdeaTranslationsclass IdeaForm(forms.ModelForm):    class Meta:        model = Idea        exclude = ["author"]    def __init__(self, request, *args, **kwargs):        self.request = request        super().__init__(*args, **kwargs)        self.fields["categories"].widget =          forms.CheckboxSelectMultiple()        title_field = layout.Field(            "title", css_class="input-block-level"        )        content_field = layout.Field(            "content", css_class="input-block-level", rows="3"        ) main_fieldset ...

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.