Friday, May 22, 2020

Re: How to Insert Foreign Key into my user model with Abstractbaseuser


Le jeu. 21 mai 2020 à 13:11, 박지훈 <llet1019@gmail.com> 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 

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 django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8389b104-c5f0-4936-b8ea-0ec9a82a5460%40googlegroups.com.


--

HAJAR BENJAT

2nd year Specialized Master in Information Systems Engineering

At CADI AYYAD UNIVERSITY FSSM Marrakech

P: +212698608188                   

E: hajar.benjat@edu.uca.ma

LinkedIn: https://www.linkedin.com/in/hajar-benjat-a92132106

--
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 django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMcj6WeEsyBJz5d-fS_fh832FsSk7iMEeyMWEBuUvHsrwPSvNQ%40mail.gmail.com.

No comments:

Post a Comment