Skip to content

Instantly share code, notes, and snippets.

@mbylstra
Last active December 19, 2015 06:59
Show Gist options
  • Save mbylstra/5915835 to your computer and use it in GitHub Desktop.
Save mbylstra/5915835 to your computer and use it in GitHub Desktop.
If you just want to use Django Rest Framework for authentication and just want to convert a dictionary to json.
from rest_framework.renderers import JSONRenderer
from rest_framework.response import Response
from rest_framework.views import APIView
class SimpleView(APIView):
renderer_classes = (JSONRenderer,)
permission_classes = (IsAuthenticated,)
def get(self, request):
content = {'testing': 123}
return Response(content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment