Let's say I already have existing User instances in my database. Then, I just introduced a new model in my app:
user = models.OneToOneField(User, related_name='profile')
nickname = models.CharField(max_length=30, blank=True)
user.profile.nickname = 'my_nickname'
profile = UserProfile()
profile.user = user
profile.nickname = 'my_nickname'
For users already in your database, you can run a script on your django shell.
python manage.py shell
>>from .models import * >>from django.contrib.auth.models import User >>users_without_profile = User.objects.filter(profile__isnull=True) >>for user in users_without_profile: ....user.profile.nickname = 'your_choice_of_nickname' ....user.save()
Just a side note: doing a wild import like from .models import * is a bad practice, but I did it anyway just for illustration and also I didn't know you appname. Hence, import the appropriate models from the respective app.
Hope this helps you.