diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2008-09-09 14:27:27 +1000 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2008-09-09 14:27:27 +1000 |
commit | c1b2c0e5787a1ba487cda222596b0ca7ae94f288 (patch) | |
tree | efea4e6ff903a98eaa4bb08c71550c8f9b4b2c47 | |
parent | f0d09c7ad846a02c4d5d99bfe412b0ba35164150 (diff) | |
download | patchwork-c1b2c0e5787a1ba487cda222596b0ca7ae94f288.tar.bz2 patchwork-c1b2c0e5787a1ba487cda222596b0ca7ae94f288.tar.xz |
Re-save user profile after setting name
This means we get Person objects created with the correct name, rather
than the username at time of creation.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r-- | apps/patchwork/forms.py | 5 | ||||
-rw-r--r-- | apps/patchwork/models.py | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/apps/patchwork/forms.py b/apps/patchwork/forms.py index c02d11e..bc746bd 100644 --- a/apps/patchwork/forms.py +++ b/apps/patchwork/forms.py @@ -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): diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index 11457d7..fb2ccc7 100644 --- a/apps/patchwork/models.py +++ b/apps/patchwork/models.py @@ -122,7 +122,7 @@ class UserProfile(models.Model): person.save() else: for person in people: - person.user = self.user + person.link_to_user(self.user) person.save() def __str__(self): |