mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-10-29 06:57:36 +03:00
In the "Creating custom mixins" documentation, the code example recommends using ```python if self.kwargs[field] ``` However, if the correct field is not present in kwargs, a KeyError arises. A more secure option is tu use .get() to validate that the field is contained in the kwargs dictionary: ```python if self.kwargs.get(field) ``` |
||
|---|---|---|
| .. | ||
| api-guide | ||
| community | ||
| coreapi | ||
| img | ||
| topics | ||
| tutorial | ||
| CNAME | ||
| index.md | ||