Commit a157cc69 authored by Florent Chehab's avatar Florent Chehab
Browse files

Better backend handling for userData

parent 55165034
...@@ -24,6 +24,11 @@ class UserDataSerializer(MyModelSerializer): ...@@ -24,6 +24,11 @@ class UserDataSerializer(MyModelSerializer):
user = self.get_user_in_request() user = self.get_user_in_request()
self.override_validated_data({'owner': user}) self.override_validated_data({'owner': user})
# we try to recover the correct instance
query = UserData.objects.filter(owner=user)
if len(query) == 1:
self.instance = query[0]
class Meta: class Meta:
model = UserData model = UserData
fields = '__all__' fields = '__all__'
......
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