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

2020-05-22 Thread HJ
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  *
>
>
> *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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0bcd4d68-47c7-4479-bdea-01e58f604529%40googlegroups.com.


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

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

Le jeu. 21 mai 2020 à 13:11, 박지훈  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+unsubscr...@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.ben...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMcj6WeEsyBJz5d-fS_fh832FsSk7iMEeyMWEBuUvHsrwPSvNQ%40mail.gmail.com.


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

2020-05-21 Thread meera gangani
You Can Try this one

 user = models.ForeignKey(User, on_delete=models.CASCADE)


On Thu, May 21, 2020 at 5:41 PM 박지훈  wrote:

> 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+unsubscr...@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
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANaPPPJciGr2R%2BMDHxcg%3DKfU1RT%3D%3DEnAGGtb759EEkz-W4fVjg%40mail.gmail.com.


How to Insert Foreign Key into my user model with Abstractbaseuser

2020-05-21 Thread 박지훈


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+unsubscr...@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.