mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-22 23:04:21 +00:00
🐛 Make POST requests return all fields on creation
This commit is contained in:
parent
ebc6a02206
commit
e71884a7f3
1 changed files with 6 additions and 3 deletions
|
@ -4,13 +4,15 @@ properly.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
import typing
|
|
||||||
import abc
|
import abc
|
||||||
|
import typing
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
from django.db import models
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.db import models
|
||||||
from rest_framework.serializers import ModelSerializer
|
from rest_framework.serializers import ModelSerializer
|
||||||
|
|
||||||
from sophon.core.enums import SophonGroupAccess
|
from sophon.core.enums import SophonGroupAccess
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,7 +156,8 @@ class SophonModel(models.Model):
|
||||||
class CreateSerializer(ModelSerializer):
|
class CreateSerializer(ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = cls
|
model = cls
|
||||||
fields = list(cls.get_creation_fields())
|
fields = list(cls.get_fields().union(cls.get_creation_fields()))
|
||||||
|
read_only_fields = list(cls.get_fields().difference(cls.get_creation_fields()))
|
||||||
|
|
||||||
return CreateSerializer
|
return CreateSerializer
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue