Skip to content

Instantly share code, notes, and snippets.

@jason-kane
Created July 18, 2015 14:29
Show Gist options
  • Save jason-kane/b66982d63ab81c0db6b3 to your computer and use it in GitHub Desktop.
Save jason-kane/b66982d63ab81c0db6b3 to your computer and use it in GitHub Desktop.
DRS MyCustomView without params
class MyCustomView(APIView):
"""
This is a custom view that can be anything at all.
It's not using a serializer class, but I can define my own parameters.
Cet exemple démontre l'utilisation de caractères unicode
"""
def get(self, *args, **kwargs):
"""
Get the single object.
"""
return Response({'foo': 'bar'})
def post(self, request, *args, **kwargs):
"""
Post to see your horse's name.
"""
return Response({'horse': request.GET.get('horse')})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment