How to do it...

To complete the recipe, follow these steps:

  1. We create MovieFilterForm with all of the possible categories to filter by:
# movies/forms.pyfrom django import formsfrom django.utils.translation import ugettext_lazy as _from .models import Genre, Director, Actor, RATING_CHOICESclass MovieFilterForm(forms.Form):    genre = forms.ModelChoiceField(        label=_("Genre"),        required=False,        queryset=Genre.objects.all())    director = forms.ModelChoiceField(        label=_("Director"),        required=False,        queryset=Director.objects.all())    actor = forms.ModelChoiceField(        label=_("Actor"),        required=False,        queryset=Actor.objects.all())    rating = forms.ChoiceField(        label=_("Rating"),        required=False,        choices=RATING_CHOICES)
  1. We create a movie_list view that will ...

Get Django 2 Web Development Cookbook - Third 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.