Skip to content
Snippets Groups Projects
Commit 54851033 authored by Sylvain Le Bon's avatar Sylvain Le Bon
Browse files

bugfix: Force no CSRF

parent 1f107e7a
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ from django.apps import apps
from django.conf import settings
from django.conf.urls import url
from django.utils.decorators import classonlymethod
from rest_framework.authentication import SessionAuthentication
from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser
from rest_framework.viewsets import ModelViewSet
......@@ -20,11 +21,16 @@ class JSONLDParser(JSONParser):
data = super(JSONLDParser, self).parse(stream, media_type, parser_context)
return jsonld.compact(data, ctx=data["@context"])
class NoCSRFAuthentication(SessionAuthentication):
def enforce_csrf(self, request):
return
class LDPViewSet(ModelViewSet):
model = None
renderer_classes = (JSONLDRenderer, )
parser_classes = (JSONLDParser, )
authentication_classes = (NoCSRFAuthentication,)
def __init__(self, **kwargs):
super().__init__(**kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment