Thanks! On Wed, Feb 16, 2011 at 1:43 AM, Ian Clelland <clell...@gmail.com> wrote:
> > > user=User.objects.create_user(username=username,email=email,password=password) > > except django.db.utils.IntegrityError: > > print 'user exists' > > user=User.objects.get(username=username) > > user.firstname=first_name > > user.lastname=last_name > > user.save() #make sure we have the user before we fiddle around > > with his name > > #up to here, things work. > > user.profile.age=34 > > user.save() > > > The question is, why doesn't the age update? > > This doesn't do what you are expecting, simply because saving the user > object is different from saving the profile object. (user.save() just > updates a row in the auth_user table, which doesn't affect the > accounts_userprofile table at all.) > > The way I would do it is this: > > profile = user.get_profile() > profile.age = 34 > profile.save() > > Try that, and see if it updates the database. > > -- > Regards, > Ian Clelland > <clell...@gmail.com> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.