Commit c1b2c0e5 authored by Jeremy Kerr's avatar Jeremy Kerr
Browse files

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: default avatarJeremy Kerr <jk@ozlabs.org>
parent f0d09c7a
......@@ -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):
......
......@@ -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):
......
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