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
  • 235,170
  • 19
  • 170
  • 241
user1584120
  • 1,169
  • 2
  • 23
  • 44

1 Answers1

0

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

Linovia
  • 19,812
  • 4
  • 47
  • 48