Set the action on a view when override_method regardless of its None-ness by cancan101 · Pull Request #2933 · encode/django-rest-framework (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation5 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Seems okay. Could you summarize the intent here, as #2062 is a pretty long thread. In what situation does your example get_serializer_class
method (which is a pattern I'd advocate for) fail if we don't make this change?
The way the browsable API resolves the form to render is by using override_method
the incoming request and changes the method to POST
it then takes that requests and calls get_serializer_class
on the view. The problem is for a given action if the view has POST support but not get support the override_method
leaves the action passed to get_serializer_class
as None.
This means that in the special case where the originally resolved action on the GET request was None
the get_serializer_class
doesn't see what would have been the resolved action when/if the POST request comes in,
Probably time for this to go in.
Is there any point in writing a test case for this, or do we consider that overkill, given that it's prob a bit awkward to test for?
Don't think I particularly care either way but happy enough for anyone else to chime in.
tomchristie added a commit that referenced this pull request
Set the action on a view when override_method regardless of its None-ness
This was referenced
Mar 9, 2017
This was referenced
Oct 6, 2017
This was referenced
Oct 16, 2017
This was referenced
Nov 6, 2017
This was referenced
Nov 6, 2017
This was referenced
Nov 14, 2017
This was referenced
Dec 10, 2017
2 participants