blubber / django_injector

Dependency injection in Django.
BSD 2-Clause "Simplified" License
49 stars 7 forks source link

Added compatibility for DRF's .as_view() method #15

Closed diachkov-lightit closed 3 years ago

diachkov-lightit commented 3 years ago

I had an issue when using django_injector with drf-yasg2: the schema was generated only for ViewSets skipping all my DRF's APIView subclasses. The Schema generator (the one, the is built in Django REST Framework) was expecting each DRF view to have .initkwargs property, but django_injector APIView wrapper (which is actually the replacement) was not setting this property.

Link to DRF source code where it sets the .initkwargs property: https://github.com/encode/django-rest-framework/blob/master/rest_framework/views.py#L140

blubber commented 3 years ago

I;ve just released version 0.2.4 to PyPI that includes this fix. Thanks!