Files
mayan-edms/mayan/apps/rest_api/api_views.py
Roberto Rosario 627056f1ae Refactor the REST API app
Remove the APIRoot view.

Remove the Endpoint class.

Remove the EndpointSerializer.

Move API documentation generation from the root urls module
to the app's urls module.

Update the app API URL generation to be based on viewsets
instead of an custom api_urls list.

Remove MayanObjectPermissionsFilter and replace it with
MayanViewSetObjectPermissionsFilter which allows mapping
a required permission to a specific viewset action.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
2019-02-06 05:19:07 -04:00

24 lines
567 B
Python

from __future__ import unicode_literals
from drf_yasg.views import get_schema_view
from rest_framework import permissions, renderers
from rest_framework.authtoken.views import ObtainAuthToken
from .schemas import openapi_info
class BrowseableObtainAuthToken(ObtainAuthToken):
"""
Obtain an API authentication token.
"""
renderer_classes = (renderers.BrowsableAPIRenderer, renderers.JSONRenderer)
schema_view = get_schema_view(
openapi_info,
validators=['flex', 'ssv'],
public=True,
permission_classes=(permissions.AllowAny,),
)