bug fixes

This commit is contained in:
Alexander Karpov 2022-11-02 14:32:46 +03:00
parent 13ab4ea2c2
commit 26b3dc5497

View File

@ -165,11 +165,15 @@ class ListProjectSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = Project model = Project
fields = ["url", "created"] fields = ["slug", "url", "created"]
extra_kwargs = { extra_kwargs = {
"slug": {"read_only": True},
"created": {"read_only": True}, "created": {"read_only": True},
} }
def create(self, validated_data):
return Project.objects.create(user=self.context["request"].user)
class ProjectSerializer(serializers.ModelSerializer): class ProjectSerializer(serializers.ModelSerializer):
files = ListDicomSerializer(many=True) files = ListDicomSerializer(many=True)
@ -177,3 +181,6 @@ class ProjectSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = Project model = Project
fields = ["files", "slug", "created"] fields = ["files", "slug", "created"]
def create(self, validated_data):
return Project.objects.create(user=self.context["request"].user)