You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2022/04/26 20:08:59 UTC
[airavata-django-portal] 05/06: AIRAVATA-3565 Fix saving updates to extended user profile fields
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch AIRAVATA-3562
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit bdd614dc5f79b72e7fc3c3967699c00e35afed65
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Apr 26 14:25:57 2022 -0400
AIRAVATA-3565 Fix saving updates to extended user profile fields
---
django_airavata/apps/auth/serializers.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/django_airavata/apps/auth/serializers.py b/django_airavata/apps/auth/serializers.py
index 61fc0239..7d3a61dc 100644
--- a/django_airavata/apps/auth/serializers.py
+++ b/django_airavata/apps/auth/serializers.py
@@ -189,6 +189,7 @@ class ExtendedUserProfileFieldSerializer(serializers.ModelSerializer):
id=choice_id,
defaults=choice,
)
+ instance.single_choice.save()
elif instance.field_type == 'multi_choice':
instance.multi_choice.other = validated_data.get('other', instance.multi_choice.other)
choices = validated_data.pop('choices', None)
@@ -202,8 +203,10 @@ class ExtendedUserProfileFieldSerializer(serializers.ModelSerializer):
id=choice_id,
defaults=choice,
)
+ instance.multi_choice.save()
elif instance.field_type == 'user_agreement':
instance.user_agreement.checkbox_label = validated_data.pop('checkbox_label', instance.user_agreement.checkbox_label)
+ instance.user_agreement.save()
# update links
links = validated_data.pop('links', [])
@@ -211,6 +214,7 @@ class ExtendedUserProfileFieldSerializer(serializers.ModelSerializer):
instance.links.exclude(id__in=link_ids).delete()
for link in links:
link_id = link.pop('id', None)
+ link['field'] = instance
models.ExtendedUserProfileFieldLink.objects.update_or_create(
id=link_id,
defaults=link,