]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/forms.py
Save UserPersonConfirmations after activating
[patchwork] / apps / patchwork / forms.py
index 7385ced14b4337f7030f46286fe5b948b99a064a..bc746bd11c580deb3031dbaa1925bf36920d29de 100644 (file)
@@ -44,6 +44,11 @@ class RegistrationForm(RegistrationFormUniqueEmail):
         user.first_name = self.cleaned_data.get('first_name', '')
         user.last_name = self.cleaned_data.get('last_name', '')
         user.save()
+
+       # saving the userprofile causes the firstname/lastname to propagate
+       # to the person objects.
+       user.get_profile().save()
+
         return user
 
     def clean(self):
@@ -77,7 +82,7 @@ class CreateBundleForm(forms.ModelForm):
 
 class DelegateField(forms.ModelChoiceField):
     def __init__(self, project, *args, **kwargs):
-       queryset = User.objects.filter(userprofile__in = \
+        queryset = User.objects.filter(userprofile__in = \
                 UserProfile.objects \
                         .filter(maintainer_projects = project) \
                         .values('pk').query)
@@ -86,10 +91,10 @@ class DelegateField(forms.ModelChoiceField):
 
 class PatchForm(forms.ModelForm):
     def __init__(self, instance = None, project = None, *args, **kwargs):
-       if (not project) and instance:
+        if (not project) and instance:
             project = instance.project
         if not project:
-           raise Exception("meep")
+            raise Exception("meep")
         super(PatchForm, self).__init__(instance = instance, *args, **kwargs)
         self.fields['delegate'] = DelegateField(project, required = False)
 
@@ -172,7 +177,7 @@ class MultiplePatchForm(PatchForm):
         super(MultiplePatchForm, self).__init__(project = project,
                 *args, **kwargs)
         self.fields['delegate'] = OptionalDelegateField(project = project,
-               required = False)
+                required = False)
 
     def save(self, instance, commit = True):
         opts = instance.__class__._meta