To complete the recipe, follow these steps:
- 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)
- We create a movie_list view that will ...