User Profile With One To One Relationship | Django (3.0) Crash Course Tutorials (pt 16)

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ม.ค. 2025

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

  • @DennisIvy
    @DennisIvy  5 ปีที่แล้ว +53

    BUG FIXES: In views.py on line 34 I added the name attribute to a customer on create. Not adding a name to the customer on create will give us an error if we try to view that customer profile since the name needs to be returned in the model __str__ method. Source code updated..
    New create method should look something like this:
    Customer.objects.create(
    user=user,
    name=user.username,
    )

    • @mahmudsajib8648
      @mahmudsajib8648 5 ปีที่แล้ว +4

      Update: Figured it out. I had to create a brand new user after updating the code. Thanks anyway!
      Hi Dennis, when I registered the new user as customer shouldn't the customer name appear on the admin site? It just shows a hyphen and clicking that gives an error. Can you take a look? imgur.com/a/wmcnsT7 [P.S. I updated the code according to your comment nothing changed]

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

      This was a great tutorial, got to know about Django a lot

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

      @@mahmudsajib8648 I have the same problem as you but when I updated the code it fixed for me but is there a way to delete that user[before updating]
      P.S. I tried deleting it from the admin page but it gives the same error as yours

    • @mahmudsajib8648
      @mahmudsajib8648 4 ปีที่แล้ว +2

      @@Chinmay_395 I flushed the entire DB and recreated users. It certainly is not the best approach but I didn’t find any other solution. Would like to see what @dennis suggest

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

      @@Chinmay_395 I have a problem in my website. Whenever i create an account for someone, his profile is shown in the navigation bar. But whenever i clicked on his profile, it is showing me errors, but if i login as an admin and add that person as a customer, now he will be able to click on his profile. Can anyone solve this problem for me please ? I want to make it like someone signs up and login as a customer automatically and view his profile without the admin to accept him as a customer and not showing the error !!!

  • @JohnnysaidWhat
    @JohnnysaidWhat 4 ปีที่แล้ว +18

    I've been pausing before Dennis actually implements each piece, trying to figure it out myself. This incredible series plus a little effort and pausing and trying to find a solution myself has helped me so much. This is an incredible series and framework!

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

      So true brother. It's been 9 hours and I have just completed 4 tutorials from 13 to this one.

    • @hey-simba
      @hey-simba 3 ปีที่แล้ว

      Excuse me what is relation between default User model and our cutome Customer model??? Customer order products nut what does normal registered User do?

  • @DennisIvy
    @DennisIvy  5 หลายเดือนก่อน +1

    Don't forget to check out my Complete Django course! dub.sh/NvGboTI

  • @stepbro1992
    @stepbro1992 4 ปีที่แล้ว +9

    hey there, in 4:00 - 4:50 you make orders = request.user.customer.order_set.all() . I do not understand where order_set comes. my terminal gives me an attribute error saying customer object has no attribute order_set

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

      i have face same problem

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

      orders

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

      your terminal has no idea of what is request and who is the user, thats why its showing you an error.. where as in user.customer.order_set.all() "order_set" is an attribute that shows up all the relations related to the customer and customer is written in lower case because that is how django gets to know you want the query set....i guess that makes sense....

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

      @@alphonseprakash7459 Thank you for this explanation Alphonse

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

      I solve that like this:
      customer=Customer.objects.get(user=request.user)
      orders = customer.order_set.all()

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

    Dennis, special thanks bro , these tutorials have put the confidence back in my life. it is been 4 days and I could pick up most of it.. thanks once again. :)

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

    You're my favorite teacher among all the others, you speak less and do more.
    usually, other guiders need 3 videos of 20 minute each for what you are able to explain in less than 10 minute long video .
    and you go more in depth and cover a lot more essential things.

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

    I'm really thankful to you, it has been great journey yet 💖💖

  • @loksewabyte
    @loksewabyte 5 ปีที่แล้ว +1

    I'm a Beginner Django Developer But im getting some knowledge from your video . Thanks For duch great content. We are expecting much more Advanced tutorials from your dide

    • @DennisIvy
      @DennisIvy  5 ปีที่แล้ว +1

      So glad my content is helping :)

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

    You are awesome bro.

  • @MrYoklmn
    @MrYoklmn 5 ปีที่แล้ว +2

    Денис, молодец, полезное видео! Сейчас как раз этим воспользуюсь)

    • @DennisIvy
      @DennisIvy  5 ปีที่แล้ว +2

      Спасибо большое 😊

    • @MrYoklmn
      @MrYoklmn 5 ปีที่แล้ว +1

      Денис, если Вы сможете сделать видео про грамотную работу с ОРМ именно с комбинированными сложными запросами, а также с последующей обработкой результатов queryset-ов, то будет очень круто) в любом случае спасибо большое! Я знаю, что уже есть про queryset-ы, но я имею ввиду еще более сложное, например работу с полями postgres jsonfield и arrayfield и так далее. Глубже короче.

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

    Thank you so much Dennis! You've done a really wonderful Job!! Siddhi from India....

  • @walidnewaz6475
    @walidnewaz6475 5 ปีที่แล้ว +1

    Oh!! It was an awesome journey with this episode. Now i can handle any unauthenticated request in my Software.

    • @DennisIvy
      @DennisIvy  5 ปีที่แล้ว

      Nice!!!

    • @hey-simba
      @hey-simba 3 ปีที่แล้ว

      Excuse me what is relation between default User model and our cutome Customer model??? Customer order products nut what does normal registered User do?

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

    hello brother!
    why use
    orders = request.user.customer.order_set.all()
    context = {}
    but when runserver it show User has no customer??

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

      Sa. E

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

      Same

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

      @Shishir Neupane Would you please explained what is the "customer" at "request.user.customer.order_set.all()" from?
      -The table name,
      -The user group name
      -Or the attribute at Order table
      Thanks

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

      @@WarangL the customer object of that particular requested user. A user is assigned to every customer.

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

    every part is awesome, best explanation.

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

    Hello @Dennis Ivy
    Bro, i need a help. I was following your course. And in this section i tried to take all orders from customer,
    orders = request.user.customer.order_set.all()
    But it's giving me an error that, AttributeError: 'Customer' object has no attribute 'order_set'.
    i've checked my models.py and models relations... everything is almost similar don't have any major change. And i can't solve it in that case. So, will you please help me.
    I can share source code in Github if you want.
    Thanks in Advance.

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

    Can someone explain me the orders = request.user.customer.order_set.all() command, please

  • @ahsamyousaf436
    @ahsamyousaf436 2 หลายเดือนก่อน

    i'm facing a problem that when i linked my customer to a user in django admin then how can i login the customer to see his records.

  • @Kennerdoll
    @Kennerdoll 8 หลายเดือนก่อน

    Hey Dennis do you have a tutorial for Admin panel, I want to prevent supperusers from login direct to admin panel

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

    Cascade does not mean that the relationship is deleted, but actually that the child element ist deleted. Id est if a user is deleted, the associated customer is deleted as well.

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

    say if the order table is actually named thisisorder, is it gonna be request.user.costumer.thisisorder_set.all() ? still dont really understand where that order_set came from...

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

      took me a while to understand as well. "_set.all()" is actually separate command :p

  • @taeteahulu3427
    @taeteahulu3427 10 หลายเดือนก่อน

    In the customer model:
    class Customer(models.Model):
    ...
    ....
    def __str__(self):
    return str(self.name)

  • @DeepakKumar-uz4xy
    @DeepakKumar-uz4xy 4 ปีที่แล้ว

    dennish ur tutorial is very good.

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

    Hi, I am having a problem when trying to load the page: User has no customer, please someone help me

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

    After registration, customers is created but the string it show in admin panel is '-' when I click on it, it gives me an error - __str__ returned non-string (type Nonetype)
    and I am also unable to delete the customer
    Please Help!

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

    what if i didnt use the User model but my own custom model; what do i put for orders=request.?

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

    Hi, I am getting an error when trying to run the server: "User has no customer .".. I did everything like in the tutorial what should I do?

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

    i have typed same .create method
    with user and username but it shows
    indentation error😕
    help me🙏

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

    Love your videos! Best django tutorials I have come by so far :)
    I did have an issue with a the customer created before applying the bug fix. I ended up with a customer that I could not delete in the admin panel. It gave me __str__ returned non-string error. This was because the __str__ function in the Customer model returned None (models.py). Had to changed the return to: return self.name or ' ' and then I was able to delete the customer.

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

      Do like this. return str(self.name). Convert it to string

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

      Thanks, that worked for me to remove the bugged customer.

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

    Hi, Dennis in my django application I have a profile separate from logging in how do I make a user have a blank user as soon as they register?

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

    Can someone explain (orders = request.user.customer.order_set.all()) in userpage view and what word customer and order_set means

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

    please explain the " orders = request.user.customer.order_set.all()" user is relate with customer and customer is related with the order model. but what is the purpose of the request ?

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

      This allows us to query a particular customers orders to render out on the users page.

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

      @@DennisIvy is the order_set related_name in customer?

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

      @@DennisIvy In what file do you create order_set? I downloaded your repository and searched through every file with grep, but I can not find order_set.
      //edit: Got it. order_set is only available for OneToMany Relationships.

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

      @@smaxxx1337 What is order_set?

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

    Hi Dennis, how are you doing?
    Thanks for the long series IAM following along.
    I have got a error here , where the user profile dashboard isn't opening when I log in as customer

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

    can,t find the latest source code... i mean the link has only source code available upto 12th series not after that.. Can you please provide ....Thanks

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

      Sorry about that, I'll update it soon. All source code from video #12 and up is linked directly in the video.

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

    I am having this error :
    duplicate key value violates unique constraint "account_customer_email_key". when registering the user and adding to the customer group
    I am using PostGre instead of SqLIte

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

    Whenever i am registering user as a Student I got an error of 'function, object has no attributes 'objects'

  • @ahmadirfan7840
    @ahmadirfan7840 4 ปีที่แล้ว +2

    I like your tutorials and I followed all your Django crash course tutorials until this one-to-one user profile. I think my head is kinda overload at this moment and will be exploded anytime soon (laugh). But I am stuck at the part of user role base permission. I just wondering if Django docs have provided some source code as yours, especially in decorators.py.

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

    Hello,, When i Use Foreign key into a Model and Create Form Of this Model with the Help of ModelForm,,, The Django Debug Tool Bar showing duplicate queries for Foreign key Field...

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

    Its very useful thanks

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

    hello bro i have a profile model with onetoone user relationship and i have an attribute called type wich has many choices how every user with a choice has diffrent profile page how coulad i manage this in the views file to choose between this choices and run the correct profile page thankyou bro

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

    'User' object has no attribute 'Patients'.i don't have any idea where i'm going wrong

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

      facing same issue.

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

      @@djangodeveloper2973 Hello I am trying same thing and i want to see if problem is solved

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

      @@djangodeveloper2973 could you rectify the error

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

    thank you for lesson

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

    correction guys your register should look like this
    form= createuserForm()
    if request.method=="POST":
    form=createuserForm(request.POST)
    if form.is_valid():
    user=form.save()
    Username=form.cleaned_data.get('username')

    messages.success(request,"profile was created for"+ Username)
    Customer.objects.create(user=user,name=Username)
    return render(request,'login.html')
    context={'form':form}
    return render(request,'register.html',context)

  • @jppachar
    @jppachar 5 ปีที่แล้ว

    Genial !! espero el siguiente vídeo Saludos desde Ecuador

    • @DennisIvy
      @DennisIvy  5 ปีที่แล้ว +1

      ¡Gracias! Más videos próximamente :)

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

    The view accounts.decorators.wrapper_function didn't return an HttpResponse object. It returned None instead.
    How can I debug this problem?

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

      The problem is appearing in the admin_only decorator when called from views.py

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

      stackoverflow.com/questions/61074171/django-the-view-accounts-decorators-wrapper-function-didnt-return-an-httpresp/61075143#61075143

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

    ValueError at /
    The view accounts.decorators.wrapper_function didn't return an HttpResponse object. It returned None instead.
    Bro please help

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

      stackoverflow.com/questions/61074171/django-the-view-accounts-decorators-wrapper-function-didnt-return-an-httpresp/61075143#61075143

  • @mohammedqadir3851
    @mohammedqadir3851 5 ปีที่แล้ว

    Thank you so much sir more and more

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

    The view accounts.decorators.wrapper_function didn't return an HttpResponse object. It returned None instead.
    why this problem happen ?

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

      stackoverflow.com/questions/61074171/django-the-view-accounts-decorators-wrapper-function-didnt-return-an-httpresp/61075143#61075143

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

    Excellent series. I've been able to learn a lot. I have an issue though when using the admin_only decorator for the home page , I get the following error. "The view accounts.decorator.wrapper_function didn't return an HttpResponse object. It returned none instead" Can someone help me with this?
    Thanks

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

      I'm getting the same error. Did you figure it out?

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

      I also get same error

    • @sambisset4338
      @sambisset4338 4 ปีที่แล้ว +2

      The user your logging in as doesnt have the admin/customer group assigned to it , log into the admin interface and assign the user you are using to one of them groups

    • @Raul-tw2xx
      @Raul-tw2xx 3 ปีที่แล้ว

      @@sambisset4338 Nice, thank you !

  • @MuhammadMahirQ8
    @MuhammadMahirQ8 5 ปีที่แล้ว

    Hi dennis. You taught us to set permission and roles for one user that is 'Customer' but what If we have more then one user type.
    For example you had group = Group.objects.get(name='customer'). You are specifying for only customer but what if I have, teacher, student, stuff, faculty so on. Will we write if statements for every user type and then register.
    Thank you

    • @DennisIvy
      @DennisIvy  5 ปีที่แล้ว +2

      Great question! So I wrote the decorator to take in a list of allowed roles so you can just add it like this: @allowed_users(allowed_roles=['customer', teacher'])
      Now if that user has more that one role we will need to change the condition in the decorator to accept this. For example write now we just query the users first group name but this would need to change if we want the user as a part of multiple groups.

    • @MuhammadMahirQ8
      @MuhammadMahirQ8 5 ปีที่แล้ว +1

      @@DennisIvy Ok cool. But I am asking for the registration method. Now your registration is only being registered as a customer.
      group = Group.objects.get(name='customer')
      but now since I have different users, how would I select a user for a particular role for example teacher, staff while registering. Shall the registration page have a drop down from the user types and what logic would you write in the reg function. In your case its only for customer. I want to make this dynamic.
      @6:53 you said when ever a user is registered we make sure it assigns a customer profile. But I want to have a choice of different users but not just customer. How would I achieve that.
      Thank You so much for you support

    • @DennisIvy
      @DennisIvy  5 ปีที่แล้ว +3

      @@MuhammadMahirQ8 I guess there's a few ways to go about this. One would be to create a different registration page for each type of user and write the logic into the view (Not practical but it would work). Another would be to send an email to a super admin and they would be in charge of setting roles and approving users.
      You could have a dependent form that asks the user questions like "Are you a teacher?" and depending on what they select the view would set groups according. This type of logic makes much more sense when I get to django signals in video #18.

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

    Excellent course
    21/07/2020

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

    your github only shows up to branch 11 and branch 12 and up is 404 not found.

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

    ValueError: The view accounts.decorators.wrapper_function didn't return an HttpResponse object. It returned None instead.
    [27/May/2020 18:40:43] "GET / HTTP/1.1" 500 62030
    ..Anyone Can Solve this

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

      i had same issues. i had forgotten to give "admin" group to admin

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

      stackoverflow.com/questions/61074171/django-the-view-accounts-decorators-wrapper-function-didnt-return-an-httpresp/61075143#61075143

  • @technoinfoworldwide2329
    @technoinfoworldwide2329 5 ปีที่แล้ว

    can you explain me in real world who can use this ,i mean does outside customer have permission to see or staffs member allowed to see the customers product? i got little bit confuse on this !!

    • @DennisIvy
      @DennisIvy  5 ปีที่แล้ว

      I'm not sure I fully get your question but I'll try my best to explain.
      A user should only be allowed to see the page that's relevant to them. So if you log into your TH-cam channel you should only see your data.
      But lets say someone who works at youtube needs to see their own version of a dashboard that shows all of users and theses users information. They wouldn't want you as a user seeing the main dashboard so you can solve this by setting permission levels like "User", "Admin", "Super admin", etc.
      We could however allow a super admin view a users page but there would need to be some extra logic written to allow this.
      Is that what you were asking?

    • @technoinfoworldwide2329
      @technoinfoworldwide2329 5 ปีที่แล้ว

      @@DennisIvy suppose i have companys product selling and need to keep record on this software.lets say there are 3 users,me as admin who can see everything in dashboard and assigned 2 customers in users..Now suppose our company sell products to 4 customer ,and being myself as admin ,i can see their status,products etc. As i had already assigned 2 customers in users,why not two customers from user section can see all 4 customers products,orders,status? Instead of it , you only allowed 1 customer form user can view only one customer product ,status.It would be better, every customer assigned in the user section can see every customers product,status etc.In real world, i think one customer from users is not only assigned to see 1 customers details only....please ,correct me if i am wrong

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

    So may be it better to use auth.model.user than models.Model as a customer

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

    Sir, where do I find the whole course?

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

      Go to my channel and click the playlists tab. I have about 5 playlist, this course is one of them.

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

    Sir I'm a beginner. Can you make a tutorial on update user profile. This very complex for me.

  • @jhoncena1742
    @jhoncena1742 5 ปีที่แล้ว

    Hello sir, I am good in c# , but I love Python, can you help me where should I start from? I'm new to Python

    • @DennisIvy
      @DennisIvy  5 ปีที่แล้ว +3

      Getting started I recommend you check out Corey shaders channel, excellent python course there. What are you trying to accomplish with python? Web development?

    • @jhoncena1742
      @jhoncena1742 5 ปีที่แล้ว

      Yes for Web development

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

    The view accounts.decorators.wrapper_function didn't return an HttpResponse object. It returned None instead.

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

      stackoverflow.com/questions/61074171/django-the-view-accounts-decorators-wrapper-function-didnt-return-an-httpresp/61075143#61075143

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

    I really like your course, I learned a lot about Django, but as a computer scientist I have to say that the database design is confusing and not really functional, regarding the way in which you implemented the users/customers.
    I know that this is the default approach proposed by documentations, but it would be interesting to see a more tailored approach.
    I still like your videos, of course.

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

    i think it's going too much for me rn, i should take a break and start from scratch.

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

    Someone else is having problems rendering statics after Pycharm upgrade to 2020.1?

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

    GREAAAT

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

    wonderfull

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

    i have a errors in group = Group.objects.get(name='customer')
    user.groups.add(group)

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

    So if you are facing the issue with the row: orders = request.user.customer.order_set.all()
    AttributeError: 'Customer' object has no attribute 'order_set'.
    I am not sure what was the problem, but I believe, it is related to the number of connections you have to your Customer.
    for example I have my TeamMember class instead of Customer, and I have 2 relations to that modle from the model Task
    The way I fixed it was:
    from django.db.models import Q
    tasks = Task.objects.filter(Q(caller=request.user.teammember) | Q(assigned_to=request.user.teammember))
    where Task is my model related to my TeamMember,
    caller and assigned to are the relations:
    assigned_to = models.ForeignKey . . .
    caller = models.ForeignKey . . .
    teammember is just my TeamMember model, but it's the way django calls it.

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

    07:42

  • @AceHardy
    @AceHardy 5 ปีที่แล้ว

    👑🙏

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

    Hey!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

    Osm

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

    WTH again i don't know what's wrong with you but look what you did you said user = form.save() instead of form = form.save() you could have use username for create user lol.