-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about usage of allow_create and allow_nested_updates #63
Comments
Yes, that is correct. |
Ok thanks for the confirmation. Is there a reason why the ListSerializer applies |
I think i see what you're talking about, here: django-rest-witchcraft/rest_witchcraft/serializers.py Lines 784 to 792 in f7de546
the check on |
I'm a little confused about the intended way to use
allow_create
andallow_nested_updates
. From what I can understandallow_create
means that if there isn't a related record a blank model will be instantiated:django-rest-witchcraft/rest_witchcraft/serializers.py
Lines 693 to 694 in f7de546
There seems to be an inconsistency in how
allow_create
is used when the nested serializer is a ListSerializer (many=True) versus when it is a BaseSerializer.As a ListSerializer setting
allow_create=True
impliesallow_nested_updates=True
because the related object will be treated the same way:django-rest-witchcraft/rest_witchcraft/serializers.py
Lines 784 to 792 in f7de546
But as a BaseSerializer setting
allow_create=True
alone will instantiate a blank model but will not update it unless you also setallow_nested_updates=True
:django-rest-witchcraft/rest_witchcraft/serializers.py
Lines 763 to 776 in f7de546
Setting
allow_create=True
alone will save the nested serializer with null for all values.I can't tell if this difference in behavior is intentional or a bug. Can you clarify about how
allow_create
is supposed to be used?The text was updated successfully, but these errors were encountered: