1

If I have:

class Example(serializers.ModelSerializer):
    time = DateTimeRangeField(required=False)

it will fail with an error:

{'time': ['This field is required.']}

However if this was serializers.Serializer it respects the required attribute on the field. Has anybody else come across this? Any ideas on how to make a field not required?

eyllanesc
  • 221,139
  • 17
  • 121
  • 189
user1584120
  • 1,089
  • 2
  • 19
  • 38

1 Answers1

0

DateTimeRangeField is not a Django REST framework field so it's like you did not provide any field at all.

Linovia
  • 17,635
  • 4
  • 36
  • 39