-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Propagate 'default' from model_field to serializer field. #9030
Conversation
Fix #7469.
Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
…nd added that to options action response
I think we should also document the intended side effect for this change |
@auvipy Okay. should i create list of side effects? |
that would be great |
Hey Rizwan! would be great if you could revisit this and add some docs on the intended side effects topic here |
this is the only remaining issue to get merged for 3.15 release /~https://github.com/encode/django-rest-framework/milestones/3.15 |
@auvipy apologize for delay.
|
can you please add them as a note in the relevant doc section? |
@auvipy I have added notes regarding default value propagation from model to serializer in default argument section of serializer field |
DRF verson 3.15 propagate 'default' from model field to serializer. encode/django-rest-framework#9030
DRF verson 3.15 propagate 'default' from model field to serializer. encode/django-rest-framework#9030
DRF verson 3.15 propagate 'default' from model field to serializer. encode/django-rest-framework#9030
DRF verson 3.15 propagate 'default' from model field to serializer. encode/django-rest-framework#9030
DRF verson 3.15 propagate 'default' from model field to serializer. encode/django-rest-framework#9030
Hi! After upgrading from DRF 3.14 to 3.15 our tests broke when a model serializer that allows required=False for a non-nullable field in the corresponding model is now ignored so the endpoint that uses the serializer to create the object throws an error claiming you need to provide the value for the field. However, the value that eventually goes into the field of the model might be managed in the create method of the serializer and set there. In this example there is an entity_id field that refers to an entity field on the model. The entity_id does not need to be provided by the user as other information are used to create the Entity objects and assign to the entity field of the Customer model in the create method of the serializer.
|
As DRF encode/django-rest-framework#9030 has been reverted in 3.15.1, the related hack is no longer needed.
As DRF encode/django-rest-framework#9030 has been reverted in 3.15.1, the generated openAPI schema is missing default values, which might be revelant in the documentation.
As DRF encode/django-rest-framework#9030 has been reverted in 3.15.1, the related hack is no longer needed.
As DRF encode/django-rest-framework#9030 has been reverted in 3.15.1, the generated openAPI schema is missing default values, which might be revelant in the documentation.
As DRF encode/django-rest-framework#9030 has been reverted in 3.15.1, the related hack is no longer needed.
As DRF encode/django-rest-framework#9030 has been reverted in 3.15.1, the generated openAPI schema is missing default values, which might be revelant in the documentation.
This is PR for changes requested in PR #8130.
default fields propagated from model to serializers.
fixes /~https://github.com/encode/django-rest-framework/issues/7469