Commit 54fdc333 authored by Jean-Baptiste's avatar Jean-Baptiste

Merge branch '162-server-not-responding-on-post' into 'master'

Resolve "Server not responding on POST"

Closes #162

See merge request !89
parents 0a1c4714 3b11969e
Pipeline #4924 passed with stage
in 1 minute and 20 seconds
......@@ -207,10 +207,6 @@ class LDPSerializer(HyperlinkedModelSerializer):
serializer_url_field = JsonLdIdentityField
ModelSerializer.serializer_field_mapping[LDPUrlField] = IdURLField
@property
def data(self):
return super().data
def get_default_field_names(self, declared_fields, model_info):
try:
fields = list(self.Meta.model._meta.serializer_fields)
......
......@@ -116,6 +116,7 @@ class Batch(Model):
authenticated_perms = ['inherit', 'add']
owner_perms = ['inherit', 'change', 'delete', 'control']
nested_fields = ["tasks", 'invoice']
depth = 1
class Task(models.Model):
......@@ -141,4 +142,5 @@ class Post(Model):
owner_perms = ['inherit']
get_user_model()._meta.serializer_fields = ['@id', 'username', 'first_name', 'last_name', 'email', 'userprofile', 'conversation_set',]
get_user_model()._meta.serializer_fields = ['@id', 'username', 'first_name', 'last_name', 'email', 'userprofile',
'conversation_set', ]
......@@ -144,8 +144,10 @@ class LDPViewSet(LDPViewSetGenerator):
serializer = self.get_write_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
self.perform_create(serializer)
headers = self.get_success_headers(serializer.data)
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
response_serializer = self.get_serializer()
data = response_serializer.to_representation(serializer.instance)
headers = self.get_success_headers(data)
return Response(data, status=status.HTTP_201_CREATED, headers=headers)
def update(self, request, *args, **kwargs):
partial = kwargs.pop('partial', False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment