Extending User model using One-To-One Relationship - Django

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ก.ย. 2024

ความคิดเห็น • 22

  • @StudyGyaan
    @StudyGyaan  3 ปีที่แล้ว +2

    Django CRM Playlist - th-cam.com/play/PLSPMgrv4IuJ4WLURdlzKNx4sgsyqW8d5q.html
    Django Tips Playlist - th-cam.com/play/PLSPMgrv4IuJ6jm66M2rSZM_qIakywFoIr.html
    Django Rest Framework Playlist - th-cam.com/play/PLSPMgrv4IuJ4tPeMgDGx7XV-4VRrjzZ8t.html
    Django Oscar Shopping Website Playlist - th-cam.com/play/PLSPMgrv4IuJ5tX9Sk7hjNrHsQRC3ppRtG.html

  • @drdinislam5321
    @drdinislam5321 2 ปีที่แล้ว +1

    So wonderful bro

  • @StudyGyaan
    @StudyGyaan  4 ปีที่แล้ว +1

    Do you like this video??? Comment and tell me.....
    Complete Tutorial for BUILD DJANGO CRM FROM SCRATCH - th-cam.com/play/PLSPMgrv4IuJ4WLURdlzKNx4sgsyqW8d5q.html

  • @gabrielturrillas
    @gabrielturrillas 4 ปีที่แล้ว +3

    If i have a custom user model i have to create a field for the user model to hold the relationship? i have han error: instance.profile.save()
    AttributeError: 'UserAccount' object has no attribute 'profile'
    ty for your time

    • @gabrielturrillas
      @gabrielturrillas 4 ปีที่แล้ว +1

      the video misses the related_name in the one to one field but other than that great video ty very much

  • @puterich
    @puterich 2 ปีที่แล้ว +1

    why have two methods? Couldn't the save method be called before the create method? and why save the user and not the profile?

    • @pensameufilho
      @pensameufilho ปีที่แล้ว

      Just added "instance.profile.save()" to the first @received and worked fine. Looks like you don't need 2 signals.

  • @90daner
    @90daner 3 ปีที่แล้ว

    really thanks sir! i learing a lot!

  • @gabrielturrillas
    @gabrielturrillas 4 ปีที่แล้ว +1

    great!

  • @izzati1262
    @izzati1262 3 ปีที่แล้ว +1

    hi there, i seem to get the error: OperationalError at /admin/login/
    no such table: userprofile_profile after trying to login using superuser. what could have been wrong?

  • @punpompur
    @punpompur 2 ปีที่แล้ว

    I had logged out of the admin console before creating userprofile inside apps folder. After I created userprofile and wrote the snipper inside model.py that you showed in the video, I tried to login to the admin console but got the error "Related object does not exist". I removed apps.userprofile from LOCAL_APPS in settings.py, restarted the server and launched admin console. This time I was able to login without any error. Now I added apps.userprofile to LOCAL_APPS again, but this time I did not log out from admin console like I did earlier. I refreshed the page and was able to see the userprofile table inside the admin console this time.
    I did not understand this issue. If I am not logged in to the admin console, and after setting up userprofile inside the apps folder, I launch the server and go to admin console, why won't it let me log in with admin credentials and give "Related object does not exist" error?

  • @awantichavan8353
    @awantichavan8353 4 ปีที่แล้ว

    Hello sir.. watched Ur playlist and got the contents I was searching for.. Really you did a great job making these videos which are very much useful...but I had a doubt on the admin page we can see the "Django administration " I wanted to ask is can we change the name Django administration to some other name and if we can then can you please tell how it is possible..plzz do reply..

  • @BKFirst
    @BKFirst ปีที่แล้ว

    Can I do this If I am using AbstractUser?

  • @semih2211
    @semih2211 4 ปีที่แล้ว +1

    after created user, I cannot see profile right away.

  • @jesusj.navarro9276
    @jesusj.navarro9276 4 ปีที่แล้ว +1

    Hello friend, your videos have been very helpful to me. I have a problem with a code when creating a model, can you help me?

    • @StudyGyaan
      @StudyGyaan  4 ปีที่แล้ว +1

      Ok

    • @jesusj.navarro9276
      @jesusj.navarro9276 4 ปีที่แล้ว

      Professional Cipher I create a class called "Product" and its attributes (name, quantity, price) can I make my attribute (quantity) be added to another class?

  • @tomaszbonarkiewicz6368
    @tomaszbonarkiewicz6368 4 ปีที่แล้ว +1

    Hello, really great video, I have just used it to create extended user by myself.
    I have one question. How to use it with drf and serialization?
    I want to send POST request to create new user and fill the Profile:
    {
    "username": "test",
    "email": "aa@aa.com",
    "password": "test123",
    "password1": "test123",
    "profile": {
    "user": "test",
    "profile_field": "123",
    }
    }
    Still have some errors like -
    "profile": {
    "user": [
    "Incorrect type. Expected pk value, received str."
    ]
    }
    Do you know how to send user with profile by using one post request?

    • @harshsaraiya4509
      @harshsaraiya4509 ปีที่แล้ว

      hey. did you find the solution to this?

  • @AnishKumar-gh7yh
    @AnishKumar-gh7yh 3 ปีที่แล้ว +1

    How i can contact you its important

    • @StudyGyaan
      @StudyGyaan  3 ปีที่แล้ว

      professionalcipher@gmail.com

  • @nishantsoni5801
    @nishantsoni5801 3 ปีที่แล้ว

    USE THIS IN YOUR PROFILE MODULE:
    def __str__(self):
    return f'{self.user.username} Profile'
    this code save profile with the name of user profile example : object profile(1) saves with admin profile