Skip to content
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

Fixed #5228 Set ViewSet args/kwargs/request before dispatch #5229



Copy link

@vstoykov vstoykov commented Jun 22, 2017

This fixes issue #5228

Actually I didn't find when args, kwargs and request are set in the dispatch and just set them before that as Django does.

I found where "the magic happens". If we want restframework's request to be available as early as possible (before dispatch as is with Django's request object), even on normal API views then setting of djangorestframework's request can be done in as_view method (but should be done twice - once for APIView and once for ViewSet).
Even If we decided that it's not a problem django's request object to be available before dispatch (as is right now for APIView) because RestFramework supports Django 1.8+ we can remove setting of args and kwargs in dispatch, because they are already set by as_view decorator.

I can update the PR with these changes if you want?

@tomchristie tomchristie closed this Jul 7, 2017
@tomchristie tomchristie reopened this Jul 7, 2017
@tomchristie tomchristie merged commit 1a31959 into encode:master Jul 7, 2017
1 check was pending
Copy link

tomchristie commented Jul 7, 2017

On reconsideration, sure let's go for it.

Thanks! (And apologies for the noise)

@tomchristie tomchristie added this to the 3.6.4 Release milestone Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants