-
Book Overview & Buying
-
Table Of Contents
Becoming an Enterprise Django Developer
By :
The Prefetch() class that is provided in the django.db.models library is used to control how a prefetch_related() operation is performed. For instance, we will use it to filter and show only vehicles that are of the VehicleModel that equals "Blazer LT". We can also prefetch all related objects when performing filters in this way. To learn about how to use this class in depth, visit https://docs.djangoproject.com/en/4.0/ref/models/querysets/#prefetch-objects.
Use the following subsections to prepare your view class and template for this demonstration. The URL pattern will remain the same as the demonstration found in the Sellers view subsection of this chapter.
Follow these steps to modify your existing SellersView class for this next exercise:
/chapter_10/views.py file, add the following import statement, preferably before the existing import statements:# /becoming_a_django_entdev/chapter_10/views.py from...