django-rest-framework/docs
Daian Gan c7acdd6006
Use .get() to find correct kwargs field and avoid KeyError (#8607)
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)
```
2022-08-31 10:18:17 +01:00
..
api-guide Use .get() to find correct kwargs field and avoid KeyError (#8607) 2022-08-31 10:18:17 +01:00
community Make minor corrections in docs (#8525) 2022-06-24 14:21:51 +01:00
coreapi Update docs related to coreapi to include deprecation notice (#8186) 2021-12-08 14:38:42 +00:00
img Promote Spacinov to premium sponsorship 2022-06-06 11:07:25 +01:00
topics Change MIDDLEWARE_CLASSES to MIDDLEWARE (#8333) 2022-01-18 08:52:11 +00:00
tutorial Add trailing slash (#8604) 2022-08-22 10:52:34 +01:00
CNAME Include CNAME file 2014-11-25 16:01:32 +00:00
index.md Confirmed support for Django 4.1. (#8498) 2022-06-06 12:39:06 +01:00