Request Validation
Let’s learn how to validate the user’s request using filters.
The filters
parameter that we want to add to the use case would allow the caller to add conditions with which the user would be able to narrow the results of the model list operation. The caller would do this by using a notation like <attribute>__<operator>
. For example, specifying filters={'price__lt': 100}
should return all the results with a price
less than 100
.
Since the Room
model has many attributes, the number of possible filters is ...