AttributeError on self.request, self.args and self.kwargs · Issue #5228 · encode/django-rest-framework (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@vstoykov

Description

@vstoykov

Checklist

Steps to reproduce

Create a ViewSet and overwrite dispatch method and try to access one of self.request, self.args or self.kwargs before calling super

Expected behavior

It should return the appropriate objects

Actual behavior

It raises AttributeError

This should be related to this Django ticket https://code.djangoproject.com/ticket/19316 which was fixed before 5 years in Django 1.6 and backported to Django 1.5.
The solution is to set these in the decorator generated in as_view method as Django does (django/django@ea6b95d)

I can try to prepare a PR