Last active
December 15, 2015 16:39
-
-
Save tomchristie/5290867 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `views.py` | |
@api_view(['GET', 'POST']) # Or whatever methods the view should support. | |
def whatever(request): | |
... | |
return Response(some_data) # `some_data` should be any native python json-serializable stuff. | |
# `settings.py` | |
REST_FRAMEWORK = { | |
'DEFAULT_AUTHENTICATION_CLASSES': ( | |
'restframework.authentication.TokenAuthentication' | |
) | |
'DEFAULT_PERMISSION_CLASSES': ( | |
'restframework.authentication.IsAuthenticatedOrReadOnly' | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment