21. Custom User Model in Django - Django Complete Zero to hero

Sdílet
Vložit
  • čas přidán 22. 04. 2023
  • 21. Custom User Model in Django - Django Complete Zero to hero
    Django Custom User Model | Override Django User model | How to create a custom user model in Django
    Custom user model Django | Custom user model Django abstract user [ Custom User Model Django ]
    Learn how to use a custom user model in Django. In this video, we will override the Django user model with our custom fields in Django. This is one of the top interview questions in Django that how will you modify the Django user model. We will be adding our custom fields in Django model.
    You will be learning how to override the Django user model with custom fields we will also write our own custom manager for it. We will be seeing an example where we will adding more field to django user models to make is as a custom user model.
    🔥𝐁𝐞𝐜𝐨𝐦𝐞 𝐀 𝐑𝐨𝐜𝐤𝐬𝐭𝐚𝐫 𝐃𝐞𝐯𝐞𝐥𝐨𝐩𝐞𝐫 🚀
    Newton School's 𝐅𝐮𝐥𝐥 𝐒𝐭𝐚𝐜𝐤 𝐂𝐨𝐮𝐫𝐬𝐞 𝟐𝟎𝟐𝟐 - bit.ly/Abhijeet_up
    Newton School Official WhatsApp Support Number: +91 6362 331 200
    🔥Check these videos 🚀
    Web development project - • Create THESE AWESOME P...
    Best AI/ML projects - • BEST AI/ML PROJECT - C...
    Non-tech to Tech - • Journey from NON-TECH ...
    Javascript vs Python - • JAVASCRIPT VS PYTHON: ...
    Best backend framework - • Top Backend framework ...
    DSA projects - • 4 projects to Master D...
    Learn web development for free - • How to Learn Web devel...
    Get remote jobs - • How to get a remote de...
    Full stack python developer - • Video
    Top programming language - • Top Programming langua...
    Biggest python update - • PyScript | The Biggest...
    Python roadmap - • Complete Python Roadma...
    Node Js Vs Django - • NodeJs Vs Django Vs La...
    Best c ++ Books - • Best books to learn Ma...
    Best Project ideas - • Best projects ideas fo...
    Create flutter app in Python - • Create FLUTTER app wit...
    -----------------------------------------------------------------------------------
    𝐍𝐞𝐰𝐭𝐨𝐧 𝐒𝐜𝐡𝐨𝐨𝐥 𝐎𝐟𝐟𝐢𝐜𝐢𝐚𝐥 𝐖𝐞𝐛𝐬𝐢𝐭𝐞
    📌𝐖𝐞𝐛𝐬𝐢𝐭𝐞: bit.ly/NSYTWebsite
    📌𝐃𝐢𝐬𝐜𝐨𝐫𝐝: bit.ly/youtube-discord
    📌𝐋𝐢𝐧𝐤𝐞𝐝𝐈𝐧: bit.ly/NSYTLinkedin
    📌𝐈𝐧𝐬𝐭𝐚𝐠𝐫𝐚𝐦: bit.ly/NSYTInstagram
    📌𝐅𝐚𝐜𝐞𝐛𝐨𝐨𝐤: bit.ly/NSYTfacebook
    Connect with Abhijeet
    ✅ Instagram - / _abhijeetgupta
    ✅ Linkedin - / gupta-abhijeet
    ✅ Telegram - t.me/code_keen
    ✅ Second channel Link - • Django Soft Delete in ...
    ------- 𝐀𝐛𝐨𝐮𝐭 𝐍𝐞𝐰𝐭𝐨𝐧 𝐒𝐜𝐡𝐨𝐨𝐥 -------
    🔵NEWTON SCHOOL is an online Edtech company providing the highest-rated Certificate Course in
    -- Full-Stack Development - Certificate Course
    -- Master's in Computer Science - MIA University
    -- Master's in Data Science - IU University
    for professionals, graduates, and women.
    🌕Newton School is building a neo-university, it is also redirecting education towards a skill-oriented paradigm, wherein leading organizations and startups would be able to hire the right kind of talent in multiple organizational layers. With Newton School’s students already earning a cumulative salary of 100+ crores, Newton School will be able to en-skill and up-skill millions of tech careers and bring the conversation of employability to the podium of the world.
    - - - - - - - - - - - - - -
    If you're reading this far down, hello, you look nice today :)
    🔵To watch more videos on programming, Data Structures, Android Development, Data Science, C++, Java, React, subscribe to our channel.
    - - - - - - - - - - - - - -
    If you're reading this far down, hello, you look nice today :)
    custom user authentication in django
    custom user model django
    how to create custom user model in django
    custom user model django rest framework
    django custom user model email as username
    django auth custom user model
    django custom user model signup
    django register custom user model
    django custom user model stackoverflow
    django allauth custom user model
    django custom user model change password
    django custom user model not showing in admin
    django custom user model tutorial
    django custom user model migration
    django authentication with custom user model
    django auth with custom user model
    custom user model django 3
    django custom user model permissions
    django registration custom user model
    django cms custom user model
    custom user django admin
    create custom user model django
    creating custom user model in django
    create a custom user model django
    custom user model in django
    django custom user model admin panel
    django rest auth custom user model
    using custom user model django
    custom user model django example
    django custom user model login
    django custom user model groups

Komentáře • 74

  • @RoshanShresthaOff
    @RoshanShresthaOff Před rokem

    Thank you for the series 🥰🥰😍

  • @ayushmantiwari6441
    @ayushmantiwari6441 Před rokem

    Great

  • @crazyvashisth
    @crazyvashisth Před 9 měsíci

    Great Explanation ❤❤❤❤

  • @user-jl4ez2gf2b
    @user-jl4ez2gf2b Před 10 měsíci

    Good content

  • @hk0636
    @hk0636 Před 8 měsíci +2

    Hello sir,
    I am working on a project where I need to have 3 types of Users.
    1. Admin
    2. Customer Login
    3. Vender Login
    .............................................
    how can I make another(multiple) user in authentication and authorization section of admin panel?

  • @RoshanShresthaOff
    @RoshanShresthaOff Před rokem

    More content plz

  • @MrAn1819
    @MrAn1819 Před 11 měsíci +1

    Sir your videos are awesome. Can you please share the code also

  • @gauravrawat3109
    @gauravrawat3109 Před 11 měsíci

    How can we add multiple table and represent it in json format in Django and how we can later use it to display in html template where its child record should display under the parent

  • @coderraj3619
    @coderraj3619 Před 10 měsíci

    Sir in my project i already use User model for login, but I need another login system for different purpose so how can I code multiple login system

  • @pratikanand8386
    @pratikanand8386 Před rokem +2

    Just a thought
    I appreciate your efforts, so please accept my gratitude. However, I would advise editing your video a little more carefully because you omitted mentioning the creation of a "manager object."

  • @TMKOC2512
    @TMKOC2512 Před 11 měsíci

    sir how we can add different database like mysql with full authentication.

  • @OmSingh-ng3np
    @OmSingh-ng3np Před rokem

    Pls make a custom t-shirt selling website where use can make his or her own tshirt or can u tell me what to use for that custom edit functions

  • @helloknox
    @helloknox Před 10 měsíci

    Mujhe 4 projects bnane h, and sabhi projects m login Payroll project se krwana h...
    koi tareeka h django m ye krne ka?

  • @wajidali-pg6sb
    @wajidali-pg6sb Před 3 měsíci

    how can we implement
    Product.objects.filter(user=request.user)
    in django class based views
    its very simple while making function based views but when it comes to class based views its doesn't work
    can you please help me in implementing it in class based views

  • @mukeshrandhawe2173
    @mukeshrandhawe2173 Před rokem +3

    it's showing me keyerror:email
    during normalization of email
    please help

  • @raju_bugude
    @raju_bugude Před rokem +1

    How to check password after changing from this method.
    I'm stuck here, help me out

  • @syedtaquiimam6514
    @syedtaquiimam6514 Před 9 měsíci +2

    Hi I have an error
    "TypeError: create_superuser() missing 1 required positional argument: 'username'"
    i have written your code fromyour tutorial" Custom User Model in Django " but i have an error please let me know how to fix

    • @ajaygarg23
      @ajaygarg23 Před 7 měsíci

      I am facing the exact same error. Did you find a solution?

    • @dhananjaysingh194
      @dhananjaysingh194 Před 5 měsíci +2

      Solution:
      from django.db import models
      from django.contrib.auth.models import AbstractUser
      # Create your models here.
      from .manager import UserManager #---------------------------->import manager
      class customUser(AbstractUser):
      username = None
      phone_number = models.CharField(max_length=10, unique=True)
      email = models.EmailField(unique=True, null=True)
      user_bio = models.CharField(max_length=50)
      USERNAME_FIELD = "phone_number"
      REQUIRED_FIELDS = []
      objects = UserManager() #-----------------------------> create object
      def __str__(self):
      return self.email

  • @kajalsharma-sp7vx
    @kajalsharma-sp7vx Před 9 měsíci

    How to solve this
    keyerror email.

  • @asadabbassheikh
    @asadabbassheikh Před rokem +4

    self.UserModel._default_manager.db_manager(database).create_superuser(
    TypeError: UserManager.create_superuser() missing 1 required positional argument: 'username'
    PS D:\Aptech\Django course\core>

    • @ankitakarn6273
      @ankitakarn6273 Před 10 měsíci

      Have you solved it?? please reply I am also facing this issue😥😥😥😥😥😥

    • @Homosapien404
      @Homosapien404 Před 10 měsíci

      I am also getting same error

    • @Homosapien404
      @Homosapien404 Před 10 měsíci

      Have you solved it

    • @156sparsh7
      @156sparsh7 Před 9 měsíci

      Getting same error

    • @dhananjaysingh194
      @dhananjaysingh194 Před 5 měsíci

      Solution:
      from django.db import models
      from django.contrib.auth.models import AbstractUser
      # Create your models here.
      from .manager import UserManager #---------------------------->import manager
      class customUser(AbstractUser):
      username = None
      phone_number = models.CharField(max_length=10, unique=True)
      email = models.EmailField(unique=True, null=True)
      user_bio = models.CharField(max_length=50)
      USERNAME_FIELD = "phone_number"
      REQUIRED_FIELDS = []
      objects = UserManager() #-----------------------------> create object
      def __str__(self):
      return self.email

  • @shyammaths5705
    @shyammaths5705 Před rokem

    where is the code

  • @chiragff4616
    @chiragff4616 Před rokem +1

    usermanager.create_superuser() missing 1 required positional argument: 'username'
    Sir this error is coming please help me

    • @dhananjaysingh194
      @dhananjaysingh194 Před 5 měsíci

      Solution:
      from django.db import models
      from django.contrib.auth.models import AbstractUser
      # Create your models here.
      from .manager import UserManager #---------------------------->import manager
      class customUser(AbstractUser):
      username = None
      phone_number = models.CharField(max_length=10, unique=True)
      email = models.EmailField(unique=True, null=True)
      user_bio = models.CharField(max_length=50)
      USERNAME_FIELD = "phone_number"
      REQUIRED_FIELDS = []
      objects = UserManager() #-----------------------------> create object
      def __str__(self):
      return self.email

    • @REFLEX__777.
      @REFLEX__777. Před měsícem +1

      @@dhananjaysingh194 THanks Bro

  • @thewhitewolf8974
    @thewhitewolf8974 Před 10 měsíci

    Very Confuse.....

  • @user-be7ys5fh3t
    @user-be7ys5fh3t Před 5 dny

    Custum user django

  • @harshwarghade4383
    @harshwarghade4383 Před 4 měsíci

    For keyerror email just replace extra_fields['email']=self.normalize_email(extra_fields['email']) by extra_fields['email']=self.normalize_email('email')

  • @kajalsharma-sp7vx
    @kajalsharma-sp7vx Před 9 měsíci

    Aap pls pura btaya kro jese aapne btaya ni ki isme accounts app ko b register krna h settings. Py m Installed_Apps=[
    'accounts]

  • @chiragff4616
    @chiragff4616 Před rokem +2

    usermanager.create_superuser() missing 1 required positional argument: 'username'
    Sir this error is coming please help me 😢

    • @tapendrakaul
      @tapendrakaul Před rokem +1

      import usermanager in your models file
      from .manager import UserManager

    • @chiragff4616
      @chiragff4616 Před rokem +1

      @@tapendrakaul and then

    • @ankitakarn6273
      @ankitakarn6273 Před 10 měsíci

      please replyyy.. I am also facing this issue
      @@tapendrakaul

    • @dhananjaysingh194
      @dhananjaysingh194 Před 5 měsíci

      Solution:
      from django.db import models
      from django.contrib.auth.models import AbstractUser
      # Create your models here.
      from .manager import UserManager #---------------------------->import manager
      class customUser(AbstractUser):
      username = None
      phone_number = models.CharField(max_length=10, unique=True)
      email = models.EmailField(unique=True, null=True)
      user_bio = models.CharField(max_length=50)
      USERNAME_FIELD = "phone_number"
      REQUIRED_FIELDS = []
      objects = UserManager() #-----------------------------> create object
      def __str__(self):
      return self.email
      @@ankitakarn6273

  • @JuniorWog
    @JuniorWog Před 7 měsíci

    Bro , thank you , i really appreciate, but it would be farrr more better , if you could choose JUST ONE LANGUAGE to speak with ! REALLY

  • @user-sx2mn5dk8g
    @user-sx2mn5dk8g Před 5 měsíci

    im getting this error "django.db.utils.OperationalError: no such table: account_customuser"
    can someone help me

  • @KanpurSwagger
    @KanpurSwagger Před rokem +3

    Sir code provide karo with video❤❤❤

  • @willheartanime8381
    @willheartanime8381 Před rokem +1

    showing me--- KeyError: 'email'
    please help

  • @vishalupadhyay5963
    @vishalupadhyay5963 Před 4 měsíci

    File "C:\Users\LENOVO\Desktop\ABSARACT_USER_MODEL_DJANGO
    est\api\manager.py", line 8, in create_user
    extra_fields['email'] = self.normalize_email(extra_fields['email'])
    KeyError: 'email'
    i am getting error someone help me

    • @paarthkothari5966
      @paarthkothari5966 Před 2 měsíci

      In manager.py, update this one:
      if 'email' in extra_fields:
      extra_fields['email'] = self.normalize_email(extra_fields['email'])
      it would work, i was also getting same error.

  • @ayazkhanyousafzai5879
    @ayazkhanyousafzai5879 Před 6 měsíci

    appericated

  • @user-iu2jc9xo2n
    @user-iu2jc9xo2n Před 10 měsíci +1

    i am getting error extra_fields['email']=self.normalize_email(extra_fields['email'])
    ~~~~~~~~~~~~^^^^^^^^^
    KeyError: 'email'. please resolve

  • @ahmadsiddique8065
    @ahmadsiddique8065 Před 9 měsíci

    When u get the error: missing 1 required positional argument: 'username', do this
    In accounts model file:
    from .manager import UserManager
    // Model code
    REQUIRED_FIELDS=[]
    objects = UserManager()
    Hope this will solve the issue :)

  • @coordinacionnacionaloev7282
    @coordinacionnacionaloev7282 Před 9 měsíci

    Holy shit man, slow it down... impossible to understand what he says.

  • @Subham_Lohan
    @Subham_Lohan Před 6 měsíci +1

    Thosa who are getting error
    "TypeError: create_superuser() missing 1 required positional argument: 'username'".
    use this in your model.py file :
    from .manager import UserManager
    // Model code
    REQUIRED_FIELDS=[]
    objects = UserManager()

    • @FactFullAi
      @FactFullAi Před 4 měsíci

      This solution is working.....Thanks for helping

  • @chiragff4616
    @chiragff4616 Před rokem +1

    usermanager.create_superuser() missing 1 required positional argument: 'username'
    Sir this error is coming please help me

    • @ankitakarn6273
      @ankitakarn6273 Před 10 měsíci

      Bhai ho gya kya solve???

    • @dhananjaysingh194
      @dhananjaysingh194 Před 5 měsíci

      Solution:
      from django.db import models
      from django.contrib.auth.models import AbstractUser
      # Create your models here.
      from .manager import UserManager #---------------------------->import manager
      class customUser(AbstractUser):
      username = None
      phone_number = models.CharField(max_length=10, unique=True)
      email = models.EmailField(unique=True, null=True)
      user_bio = models.CharField(max_length=50)
      USERNAME_FIELD = "phone_number"
      REQUIRED_FIELDS = []
      objects = UserManager() #-----------------------------> create object
      def __str__(self):
      return self.email