From 321e0ced2ae6b3ac2af0223b11b76f033c3bc30a Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 7 May 2022 00:15:58 -0700 Subject: [PATCH] fix key constraint error --- src/documents/serialisers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/documents/serialisers.py b/src/documents/serialisers.py index 75b6b8cdd..9119779e8 100644 --- a/src/documents/serialisers.py +++ b/src/documents/serialisers.py @@ -515,5 +515,8 @@ class FrontendSettingsViewSerializer(serializers.ModelSerializer): return instance def create(self, validated_data): - frontend_settings = FrontendSettings.objects.update_or_create(**validated_data) + frontend_settings = FrontendSettings.objects.update_or_create( + user=validated_data.get("user"), + defaults={"settings": validated_data.get("settings", None)}, + ) return frontend_settings