Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
auvipy merged 4 commits intoencode:masterfromtienne-B:set_value_static
May 24, 2023

Conversation

@tienne-B
Copy link
Contributor

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.

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.
@stale
Copy link

stalebot commentedApr 18, 2022

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.

@stalestalebot added the stale labelApr 18, 2022
@tienne-B
Copy link
ContributorAuthor

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.

@stalestalebot removed the stale labelApr 18, 2022
@stale
Copy link

stalebot commentedJun 18, 2022

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.

@stalestalebot added the stale labelJun 18, 2022
@tienne-B
Copy link
ContributorAuthor

I repeat.

@stalestalebot removed the stale labelJun 18, 2022
@stale
Copy link

stalebot commentedOct 19, 2022

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.

@stalestalebot added the stale labelOct 19, 2022
@lovelydinosaur
Copy link
Contributor

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 astaticmethod. Agreed that it functionally is, but we don't use that much through REST framework, so let's stick with consistency.

That edit should also bump the test cases to run against this pull request.

@auvipyauvipy closed thisDec 1, 2022
@auvipyauvipy reopened thisDec 1, 2022
@auvipy
Copy link
Collaborator

That edit should also bump the test cases to run against this pull request.

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.
@tienne-B
Copy link
ContributorAuthor

@auvipy There were no tests specifically forset_value() so I've added a couple cases from the method doc.

'invalid':_('Invalid data. Expected a dictionary, but got {datatype}.')
}

defset_value(self,dictionary,keys,value):
Copy link
Collaborator

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?

Copy link
ContributorAuthor

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?

@stale
Copy link

stalebot commentedMay 21, 2023

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.

@stalestalebot added the stale labelMay 21, 2023
@tienne-B
Copy link
ContributorAuthor

I'm still interested in this, and waiting for a reply from@auvipy.

@stalestalebot removed the stale labelMay 21, 2023
@auvipy
Copy link
Collaborator

I'm still interested in this, and waiting for a reply from@auvipy.

can you edit the PR headline as per the suggested change by Tom?

tienne-B reacted with thumbs up emoji

@tienne-Btienne-B changed the titleMake set_value a static method for SerializersMake set_value a method withinSerializerMay 24, 2023
@tienne-B
Copy link
ContributorAuthor

can you edit the PR headline as per the suggested change by Tom?

Done :)

@auvipyauvipy added this to the3.15 milestoneMay 24, 2023
@auvipyauvipy merged commitd252d22 intoencode:masterMay 24, 2023
@tienne-Btienne-B deleted the set_value_static branchMay 24, 2023 14:07
saadullahaleem pushed a commit to saadullahaleem/django-rest-framework that referenced this pull requestMay 27, 2023
* 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.
saadullahaleem pushed a commit to saadullahaleem/django-rest-framework that referenced this pull requestMay 27, 2023
* 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.
auvipy added a commit that referenced this pull requestMay 29, 2023
* 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>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@auvipyauvipyauvipy approved these changes

+1 more reviewer

@blockchainGuru1018blockchainGuru1018blockchainGuru1018 approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

Projects

None yet

Milestone

3.15

Development

Successfully merging this pull request may close these issues.

4 participants

@tienne-B@lovelydinosaur@auvipy@blockchainGuru1018

[8]ページ先頭

©2009-2025 Movatter.jp