Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Make set_value a method withinSerializer#8001
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
As an alternative toencode#7671, let the method be overridden if needed. Asthe function is only used for serializers, it has a better place in theSerializer class.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
tienne-B commentedApr 18, 2022
I do think this PR is still pertinent as it would make it so I wouldn't have to override an unrelated method as I currently do. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
tienne-B commentedJun 18, 2022
I repeat. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
lovelydinosaur commentedOct 19, 2022
Okay... I'm open to considering this. We're pretty much not adding public API to REST framework anymore, but let's take a look. I'd suggest start off by changing it tonot be a That edit should also bump the test cases to run against this pull request. |
auvipy commentedDec 1, 2022
does that mean some additional tests should be added or tests should be adjusted as well? |
These tests follow the examples given in the method.
# Conflicts:#tests/test_serializer.py
tienne-B commentedFeb 28, 2023
@auvipy There were no tests specifically for |
| 'invalid':_('Invalid data. Expected a dictionary, but got {datatype}.') | ||
| } | ||
| defset_value(self,dictionary,keys,value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
do we need any documentation update // adjustments for the new changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I wouldn't think so, as the change is really just internal and does not affect howset_value() works. Would you want me to document the changes somewhere?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
tienne-B commentedMay 21, 2023
I'm still interested in this, and waiting for a reply from@auvipy. |
auvipy commentedMay 24, 2023
can you edit the PR headline as per the suggested change by Tom? |
Serializertienne-B commentedMay 24, 2023
Done :) |
* Make set_value a static method for SerializersAs an alternative toencode#7671, let the method be overridden if needed. Asthe function is only used for serializers, it has a better place in theSerializer class.* Set `set_value` as an object (non-static) method* Add tests for set_value()These tests follow the examples given in the method.
* Make set_value a static method for SerializersAs an alternative toencode#7671, let the method be overridden if needed. Asthe function is only used for serializers, it has a better place in theSerializer class.* Set `set_value` as an object (non-static) method* Add tests for set_value()These tests follow the examples given in the method.
* fix: Make the instance variable of child serializer point to the correct list object instead of the entire list when validating ListSerializer* fix formatting issues for list serializer validation fix* fix imports sorting for list serializer tests* remove django 2.2 from docs index (#8982)* Declared Django 4.2 support in README.md (#8985)* Fix Links in Documentation to Django `reverse` and `reverse_lazy` (#8986)* Fix Django Docs url in reverse.mdDjango URLs of the documentation of `reverse` and `reverse_lazy` were wrong.* Update reverse.md* fix URLPathVersioning reverse fallback (#7247)* fix URLPathVersioning reverse fallback* add test for URLPathVersioning reverse fallback* Update tests/test_versioning.py---------Co-authored-by: Jorn van Wier <jorn.van.wier@thunderbyte.ai>Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>* Make set_value a method within `Serializer` (#8001)* Make set_value a static method for SerializersAs an alternative to#7671, let the method be overridden if needed. Asthe function is only used for serializers, it has a better place in theSerializer class.* Set `set_value` as an object (non-static) method* Add tests for set_value()These tests follow the examples given in the method.* fix: Make the instance variable of child serializer point to the correct list object instead of the entire list when validating ListSerializer* Make set_value a method within `Serializer` (#8001)* Make set_value a static method for SerializersAs an alternative to#7671, let the method be overridden if needed. Asthe function is only used for serializers, it has a better place in theSerializer class.* Set `set_value` as an object (non-static) method* Add tests for set_value()These tests follow the examples given in the method.* fix: Make the instance variable of child serializer point to the correct list object instead of the entire list when validating ListSerializer* fix: Make the instance variable of child serializer point to the correct list object instead of the entire list when validating ListSerializer* fix formatting issues for list serializer validation fix* fix: Make the instance variable of child serializer point to the correct list object instead of the entire list when validating ListSerializer* fix formatting issues for list serializer validation fix* fix linting* Update rest_framework/serializers.pyCo-authored-by: Sergei Shishov <sshishov@users.noreply.github.com>* Update rest_framework/serializers.pyCo-authored-by: Sergei Shishov <sshishov@users.noreply.github.com>* fix: instance variable in list serializer, remove commented code---------Co-authored-by: Mathieu Dupuy <deronnax@gmail.com>Co-authored-by: Mehraz Hossain Rumman <59512321+MehrazRumman@users.noreply.github.com>Co-authored-by: Dominik Bruhn <dominik@dbruhn.de>Co-authored-by: jornvanwier <mail@jornvanwier.com>Co-authored-by: Jorn van Wier <jorn.van.wier@thunderbyte.ai>Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>Co-authored-by: Étienne Beaulé <beauleetienne0@gmail.com>Co-authored-by: Sergei Shishov <sshishov@users.noreply.github.com>
As an alternative to#7671, let the method be overridden if needed.
As the function is only used for serializers, it has a better place in the Serializer class than standalone in the fields file.