Complete the code to get all objects from the model.
all_items = ModelName.objects.[1]()The all() method returns all objects from the database table for the model.
Complete the code to get objects where the field 'status' equals 'active'.
active_items = ModelName.objects.[1](status='active')
The filter() method returns objects matching the given condition(s).
Fix the error in the code to get all objects with 'is_published' True.
published = ModelName.objects.[1](is_published=True)
To get all objects matching a condition, use filter(). all() does not take arguments.
Fill both blanks to get all objects where 'category' is 'books' and 'available' is True.
items = ModelName.objects.[1](**[2])
Use filter() with a dictionary of conditions to get matching objects.
Fill all three blanks to get all objects where 'price' is greater than 20 and 'in_stock' is True.
items = ModelName.objects.[1]([2]=[3])
Use filter() with the lookup price__gt to get items with price greater than 20.