can you check this , I hope it's helpful 
https://stackoverflow.com/questions/28691771/django-foreignkey-to-abstractbaseuser

Le jeudi 21 mai 2020 13:11:50 UTC+1, 박지훈 a écrit :
>
> class User(AbstractBaseUser):
>    password = models.CharField(max_length=128)
>    username = models.CharField(unique=True, max_length=150)
>    is_superuser = models.IntegerField()
>    last_name = models.CharField(max_length=150)
>    phone = models.CharField(max_length=20)
>    email = models.CharField(max_length=254)
>    date_of_birth = models.DateTimeField()
>    date_joined = models.DateTimeField()
>    last_login = models.DateTimeField(blank=True, null=True)
>    is_staff = models.IntegerField(blank=True, null=True)
>    is_active = models.IntegerField(blank=True, null=True)
>    first_name = models.CharField(max_length=30, blank=True, null=True)
>
>    
>    objects = UserManager()
>
>    USERNAME_FIELD = 'username'
>    REQUIRED_FIELDS = ['last_name', 'phone', 'email', 'date_of_birth']
>
>    def has_perm(self, perm, obj=None):
>       return True
>
>    def has_module_perms(self, app_label):
>       return True
>
>    class Meta:
>       db_table = 'auth_user'
>
>
> *This is my user model in app.models.py <http://app.models.py> *
>
>
> *I want to add foreign key into Class User. but i can`t ...*
>
>
> *please help me*
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0bcd4d68-47c7-4479-bdea-01e58f604529%40googlegroups.com.

Reply via email to