drf-forms / drf-schema-adapter

Making using Django with frontend libraries and frameworks DRYer
http://drf-schema-adapter.readthedocs.io/en/latest/
MIT License
157 stars 40 forks source link

'PlanningViewSet' object has no attribute 'get_serializer_class' #24

Closed gthieleb closed 6 years ago

gthieleb commented 6 years ago

Trying to use the drf-schema-adapter router next to a default router.

When setting default METADATA_CLASS to:

REST_FRAMEWORK = {
    'DEFAULT_FILTER_BACKENDS':
    ('django_filters.rest_framework.DjangoFilterBackend',),
    'DEFAULT_METADATA_CLASS': 'drf_auto_endpoint.metadata.AutoMetadata',
}   

OPTION is broken for viewsets that are created via routers.DefaultRouter()

router = routers.DefaultRouter()
router.register(r'middleware', MiddlewareViewSet, base_name='middleware')
router.register(r'planning', PlanningViewSet, base_name='planning')

Is it possible to add the metadaclass per serializer?

nanuxbe commented 6 years ago

There is a way to use different meta-data classes for each View, ViewSet (not for different serializers): http://www.django-rest-framework.org/api-guide/metadata/#setting-the-metadata-scheme.

gthieleb commented 6 years ago

Thanks, I will try it that way.