from future import unicode_literals
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
Register your models here.
class Profile(models.Model):
“”“(Profile description)”“”
user=models.OneToOneField(settings.AUTH_USER_MODEL,default=1)
main=models.ForeignKey(User,related_name=“main”)
name=models.CharField()
content=models.TextField()
def __unicode__(self):
return self.name
def __str__(self):
return self.name
I was hoping to know the difference between two lo of sites used foreign key tpo access user model when creating a profile and some use oneto one field so hopw are two imports different and how do they work ? please help me unmderstand them clearly !