Description
Discussed in #8696
Originally posted by smt-insens October 13, 2022
Context:
I made an HTTP OPTIONS request. In the response I have the type of each field. I have a duration field so I expected to see something like "duration" as type but instead I have "field".
Solution:
After investigation I found that DurationField
is missing in SimpleMetadata.label_lookup
This is probably due to the fact DurationField
was added to Django after the other fields. The person who added DurationField
probably forgot to add it to the label_lookup.
The following line should be added to label_lookup
: serializers.DurationField: 'duration',
django-rest-framework/rest_framework/metadata.py
Lines 36 to 58 in 20d347a
django-rest-framework/rest_framework/fields.py
Lines 1320 to 1349 in 20d347a