You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My code basically has a sort_index field, that is the position of a certain A or B.
For example, if I have a list of Bs, adding a new one updates all the sort_index, following some rules:
list_of_a= [
B(name="A", field_a=1, sort_index=1),
B(name="B", field_a=1, sort_index=2)
]
b_serializer=BSerializer(data={"name":"C", "sort_index":1})
b_serializer.save()
# final list of Bslist_of_b= [
B(name="C", field_a=1, sort_index=1),
B(name="A", field_a=1, sort_index=2),
B(name="B", field_a=1, sort_index=3)
]
Now, with version 3.16, this raises the error {'non_field_errors': [ErrorDetail(string='The fields voice_calling, sort_index must make a unique set.', code='unique')]}
This error does not occur in the ASerializer, I'm guessing because I override the constraints with the validators?
Should I add validators = [] to override it, or is some configuration that uses the Deferred?
The text was updated successfully, but these errors were encountered:
I was using the rest-framework version 3.14 and have the following code:
My code basically has a sort_index field, that is the position of a certain A or B.
For example, if I have a list of Bs, adding a new one updates all the sort_index, following some rules:
Now, with version 3.16, this raises the error
{'non_field_errors': [ErrorDetail(string='The fields voice_calling, sort_index must make a unique set.', code='unique')]}
This error does not occur in the ASerializer, I'm guessing because I override the constraints with the validators?
Should I add
validators = []
to override it, or is some configuration that uses the Deferred?The text was updated successfully, but these errors were encountered: