This is very basic, but I can’t find anything on it. I have a user profile defined in the following way:
def create_user_info(sender, instance, created, **kwargs):
if created:
UserInfo.objects.create(user=instance)
User.profile = property(lambda u: UserProfile.objects.get_or_create(user=u)[0])
Now how do I set the properties?
First off. Monkey-patching
Useris not the correct approach. SetAUTH_PROFILE_MODULE = 'yourapp.UserInfo'in settings.py, and then you can useuser_instance.get_profile()automatically to get the profile.So, then to modify the profile you just do: