Replies: 1 comment
-
i think you should check the models well and set the input of interval. also you could try viewsets with hyperlinkedModel serializer and see if the CRUD operations are working properly |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary:
Use drf ModelSerializer component to serialize PeriodicTask and set depth=1,create data report error django.core.exceptions.ValidationError: {'interval': ['One of clocked, interval, crontab, or solar must be set.']}
Exact steps to reproduce the issue:
PeriodicTaskSerializer
by DRF SerializerPeriodicTaskView
by DRF APIView,It accepts http post requests and can create tasksDetailed information
In the request parameters, I set the
interva=1
, but afterserializer.is_valid()
, there is no such parameter in theserializer.data
, Cause an exception{'interval': ['One of clocked, interval, crontab, or solar must be set.']}
to be thrown,If I didn’t set the
depth
in thePeriodicTaskSerializer
, everything works fineBeta Was this translation helpful? Give feedback.
All reactions