If you have a parent model that has OneToOne relation to some other model and you want this child model to be created upon parent model creation you need to install django-annoying package like this:
pip install django-annoying
enable annoying app and replace your models.OneToOneField
with AutoOneToOneField
like this:
class MyProfile(models.Model):
user = AutoOneToOneField(User, primary_key=True)
home_page = models.URLField(max_length=255, blank=True)
icq = models.IntegerField(max_length=255, null=True)
Hey, if you’ve found this useful, please share the post to help other folks find it: