SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 3ca2f2eb authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Use update instead of save when creating new Profile

parent a67dd883
No related branches found
No related tags found
No related merge requests found
...@@ -59,21 +59,13 @@ class ProfileForm(forms.ModelForm): ...@@ -59,21 +59,13 @@ class ProfileForm(forms.ModelForm):
instance_pk = self.cleaned_data['instance_pk'] instance_pk = self.cleaned_data['instance_pk']
if instance_pk: if instance_pk:
if self.cleaned_data['instance_from_type'] == 'contributor': if self.cleaned_data['instance_from_type'] == 'contributor':
contributor = get_object_or_404(Contributor, pk=instance_pk) Contributor.objects.filter(pk=instance_pk).update(profile=profile)
contributor.profile = profile
contributor.save()
elif self.cleaned_data['instance_from_type'] == 'unregisteredauthor': elif self.cleaned_data['instance_from_type'] == 'unregisteredauthor':
unreg_auth = get_object_or_404(UnregisteredAuthor, pk=instance_pk) UnregisteredAuthor.objects.filter(pk=instance_pk).update(profile=profile)
unreg_auth.profile = profile
unreg_auth.save()
elif self.cleaned_data['instance_from_type'] == 'refereeinvitation': elif self.cleaned_data['instance_from_type'] == 'refereeinvitation':
ref_inv = get_object_or_404(RefereeInvitation, pk=instance_pk) RefereeInvitation.objects.filter(pk=instance_pk).update(profile=profile)
ref_inv.profile = profile
ref_inv.save()
elif self.cleaned_data['instance_from_type'] == 'registrationinvitation': elif self.cleaned_data['instance_from_type'] == 'registrationinvitation':
reg_inv = get_object_or_404(RegistrationInvitation, pk=instance_pk) RegistrationInvitation.objects.filter(pk=instance_pk).update(profile=profile)
reg_inv.profile = profile
reg_inv.save()
return profile return profile
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment