Hello @kartik,
You probably have set DjangoModelPermissions as a default permission class in your settings.
Something like:
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.DjangoModelPermissions',
)
}
DjangoModelPermissions can only be applied to views that have a .queryset property or .get_queryset() method.
You can then define permissions like below:
from rest_framework.decorators import api_view, permission_classes
from rest_framework import permissions
@api_view([..])
@permission_classes((permissions.AllowAny,))
def my_view(request)
...
To resolve the renderer error, you need to add the corresponding renderer to your settings.
REST_FRAMEWORK = {
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.<corresponding_renderer>',
...
)
Hope it helps!!
Thank You!!