I need to extend django user with some additional fields . I found 2 different ways there
class UserProfile(models.Model):
user = models.OneToOneField(User)
#other fields
OR
class UserProfile(models.Model):
user = models.ForeignKey(User)
#other fields
Aren’t they same? After syncing them, i saw no difference in mysql database
No, why would you think that? A ForeignKey is a one-to-many relationship – ie a user could have many profiles. A OneToOne is, as the name implies, a one-to-one relationship – a user can only have one profile, which sounds more likely.