Dynamic URL Routing & Templates | Django (3.0) Crash Course Tutorials (pt 9)

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

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

  • @DennisIvy
    @DennisIvy  4 หลายเดือนก่อน

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

  • @shahbozabdullayev5583
    @shahbozabdullayev5583 4 ปีที่แล้ว +36

    That was my biggest question: a particular dynamic single page for every item. And I got answer after this video. Thanks a lot !!! You are the treasure we must keep!

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

      Glad it was helpful!

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

      @@DennisIvy Honestly, you helped me a lot with this question as well! Thanks)))

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

      That was my biggest question too!

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

      @@DennisIvy I cant solve this issue, anybody help? "Reverse for 'customer' with no arguments not found. 1 pattern(s) tried: ['customer/(?P[^/]+)/$']" ; using // , when i comeback into the home page, that raise up

  • @muhammadyaseenkhan9875
    @muhammadyaseenkhan9875 4 ปีที่แล้ว +7

    Far better than All udemy courses keep it up 🔥

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

    Best channel on TH-cam for Django

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

    This is so far the best tutorials ever man!!!!!!!!!!!!!!! And its free!!!!!!!!!!!! Big respect from BANGLADESH

  • @darkman8939
    @darkman8939 5 ปีที่แล้ว +12

    well explained, Thanks again for sharing ur knowledge. Making crash course with a project is a great idea better than explaining stuff separately

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

      I totally agree. I can have a concept explained to me but its not until I can put it into practice when I understand it.

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

    If yall get this error "object is not iterable"
    use filter() instead of get()

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

    Thanks Dennis. your course is better than Udemy django course👏😏

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

    count value of number of orders for a particular customer can be rendered out with {{ orders.count }} here orders being the querySet. This would avoid use of extra variable named orders_count which is now being passed in the context variable.

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

    Thanks a lot , this is the best way of teaching I had seen, You are the treasure we must keep!❤👌🌹

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

    The Best Tutorial!!!

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

    Dennis Ivy you are the best

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

    thanks man, definitely the best tutorial ever, had so much fun

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

    You are amazing Dennis

  • @akhror-oshie
    @akhror-oshie 3 ปีที่แล้ว

    I found it very useful I just enjoyed understanding from your explanation, Thanks so much and will wait such courses again!

  • @dhairya-varshney
    @dhairya-varshney 2 ปีที่แล้ว

    Helped me in my project. Thanks for the video buddy.

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

    Thank you Dennis! This course is really helping me a lot.

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

    Thank you Dennis for this great course. It is helping me a lot.

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

    Well done, good work. Only yesterday TH-cam suggested your videos to me. Of course, I will follow your account. Appreciate Django content here.
    Just one thing, I think you should have done the dynamic url using as the pk will never contain any string.

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

      I appreciate that Thomas :) And your right, "int" would be more appropriate here. I just really wanted people to understand that string values can be used in other situations, maybe like a blog name or something..

    • @grzegorz-gregmika8339
      @grzegorz-gregmika8339 5 ปีที่แล้ว

      @@DennisIvy Please change id to uuid, it would be better and more relevant to the document DB and will survive ;-)

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

      @@grzegorz-gregmika8339 That's how I normally do it but because I haven't covered uuid yet i kept it with the id. I'll probably add that as another video so I can cover the entire topic :)

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

      @@DennisIvy Hey dennis i can still open the customer/1 page as i have customer with id =1 but when it came to show the output data it doesn't show up even the {{customer.name}} doesn't show up only the lay out of the page and nothing else

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

      @@DennisIvy the thing is if it does not have any value it should return error right but it doesn't show any error i cna open the page but not one data output show

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

    we can directly call the order_set in the template without creating a new variable and pass it to the context like
    order in customer.order_set.all

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

      I am getting an error when I call order_set.all(). "function' object has no attribute 'order_set' ". I am getting this error, what should I do? any suggestions, please!

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

      @@srinivaspendem2826 iam getting the same error toooo 😭😭😭😭

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

    Excellent course
    13/07/2020

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

    This is awsome man. Thanks for sharing your knowledge for free

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

    thanks mate exactly what I needed

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

    Thank you so much! The best tutorial ever!

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

    this tutorial is so so good it has helped me alol

  • @banaras.wala.foreignaala
    @banaras.wala.foreignaala 4 ปีที่แล้ว

    Dear Dennis, thanks for making such good videos.
    Thanks,

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

    hi im a bit curious on how to use it in an tag in html. can you show me? i would deeply appreciate it

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

    thanks alooot for these videos really helpfull ♥

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

    Wow enjoy watching ur totorials

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

    That is awesome!! Thanks!

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

    @Dennis Ivy thank you so much for this crash course, that's awesome!!!
    I'm just facing a problem!!! After I code the pk method I can't request the standard path cutomer/ anymore. When I request any id the url call the correct view, but when I request only customer/ I can't match any url
    Folllow the error below:
    Using the URLconf defined in fp.urls, Django tried these URL patterns, in this order:
    admin/
    products/
    customer/
    The current path, customer/, didn't match any of these.

    • @aslamkhan-xd1jz
      @aslamkhan-xd1jz 3 ปีที่แล้ว +1

      Same here did u solve it?

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

      @@aslamkhan-xd1jz not yet, I’m trying to read django doc to find it out

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

      @@tiagotitericz3654 Hey , did you figured out ?

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

      @@Raul-tw2xx not yet, If I get it I’ll tell you 😉

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

    Wow... This was really amazing .

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

    Very nice tutorial, exactly what I was looking for. Thanks; I've subscribed. God Bless. : D

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

    U r awesome😘
    I mean i'm really getting a hang of this and it's so much fun😊

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

    how can i redirect to a dynamic url

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

    great video , thanks .

  • @ΒασίληςΖ-σ4υ
    @ΒασίληςΖ-σ4υ 4 ปีที่แล้ว +2

    Hi Dennis, Nice Job. I am facing this error : type object 'Customer' has no attribute 'object'. I had check my code so far line by line compare it with yours but i could not find something. At my "views" i am importing : "from .models import *" but seems that ignore it. Any help. I must inform you that so far the code was running (until this tutorial). The problem occured when i changed this line "path('customer//', views.customer),". Thanks Again.

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

      @Vladimir Terentev hello! I tried to use this but I can't figure out,
      how did you use that code?
      Thank you!

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

    Well explained...

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

    bro make tutorial about import UUIDField

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

    ty

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

    what if i get an error like NoReverseMatch at /students/3/ what should i do now

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

    Thankq so much..................:)

  • @tic-tac-toe7473
    @tic-tac-toe7473 4 ปีที่แล้ว

    What if i want to search the customer from form input field..how can redirect that url

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

    i want individual customer ,order date ,status table in single page how can i do that ?

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

    I don't get one thing, in Order class we set customer.ForeignKey() so that Customer was a parent to the Order and we can call in views.py customer.order_set.all() but we did the same with Product and yet in 05:47 we set {{ order.product.category }} so now Order is a parent to the Product ?? It works both ways or am I missing something ??

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

      i dont understand it too if have understand it so can u explain me please..

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

      You use {{order.product.category}} if you are accessing the parent model, and customer.order_set.all() when trying to get the child model.

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

    @6:39 my table is empty. I followed the steps correctly and can't figure out why its not working. I tested it by replacing the for loop with plain text and it showed up. But the orders aren't passing through. I have a populated database with orders.

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

    it unable to load css files and image files while passing pk_test string...please help me with this
    Refused to apply style from '127.0.0.1:8000/product-details/3/static/css/bootstrap.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

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

    FYI .... I noticed that line 10 in customer.html is missing {{ customer }} to put the customer name in the top left panel. Cheers

  • @SumitKumar-js3po
    @SumitKumar-js3po 4 ปีที่แล้ว

    Urgent answer please!
    i want to grab the loggedin user user_id .
    model is --> Profile (user,email,pic,website)

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

    Hello Sir, at 0:56 you passed pk to the customer function like customer(request,pk), so my question is, when we give a call to this function, don't we have to pass the parameter pk? because you didn't mention any of that in here.

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

    I'm confused about 'order_set', 4:17 , can you please mention where u have introduced it?

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

      u can check Database Model Queries in previous video

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

      @@rijalefendi6465 iam getting the same error too ...please help

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

    0:01 Dynamic URL routing
    3:25 Queries & Rendering data to templates
    8:35 What's next
    Note: www.notion.so/9-Dynamic-URL-Routing-Templates-b3611d6ad067484bbdeb947102a62e6e

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

    getting attribute error in customer page

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

    In line 9 of customer.html he missed including {{customer.name}} to complete the form.

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

    The link to the source code is not working. Could you please fix this, Dennis?

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

    i have been completing the course from first but i got an error// The current path, customer/, didn't match any of these.// i tried every thing can u plz help me

    • @abhishek.p6825
      @abhishek.p6825 4 ปีที่แล้ว

      check your url.py file. You would have made some mistake there..

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

      Did you solve it? I'm facing the same problem. After I code the pk I can't request the standard cutomer/ anymore. When I request any id the url call the correct view, but when I request only customer/ I can't math any url
      Folllow the error below:
      Using the URLconf defined in fp.urls, Django tried these URL patterns, in this order:
      admin/
      products/
      customer/
      The current path, customer/, didn't match any of these.

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

      @@tiagotitericz3654 did you solve it? As i m facing the same issue.

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

    I have a problem with the contact information the email and phone do not appear on my website.
    can you help me with that?

    • @gg-vl2xw
      @gg-vl2xw 4 ปีที่แล้ว

      do you find the solution?

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

    i dont undserstand order_set pls help me

    • @Ab-gf8pz
      @Ab-gf8pz 3 ปีที่แล้ว

      in Order model
      class Order(models.Model):
      choice=(('Pending','Pending'), ('Out of stock','Out of stock'),('Delivered','Delivered'))
      customer=models.ForeignKey(Customer,on_delete=models.CASCADE,null=True,related_name="customer")
      product=models.ForeignKey(Product,on_delete=models.CASCADE,null=True,related_name="product_order")

      added=models.DateTimeField(auto_now_add=True)
      status=models.CharField(max_length=200,choices=choice)
      in views.py
      def customer(request,pk):
      customer=Customer.objects.get(pk=pk)

      ##reverse relationship of Customer and Order shown in Order - customer
      ## customer.related_name
      orders=customer.customer.all()

      context={'customer':customer,
      'orders':orders
      }
      return render(request,"Accounts/customer.html",context)

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

    I cant solve this issue, anybody help? "Reverse for 'customer' with no arguments not found. 1 pattern(s) tried: ['customer/(?P[^/]+)/$']" ; using // , when i comeback into the home page, that raise up @Dennis Ivy

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

    I am getting an error at 2:28 when I refresh my browser
    Page not found (404)
    Request Method: GET
    Request URL: 127.0.0.1:8000/2/
    Using the URLconf defined in crm1.urls, Django tried these URL patterns, in this order:
    admin/
    products/
    customer//
    The current path, 2/, didn't match any of these.
    You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
    When I set debug to False I still get an error .... can anyone help me with this?

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

      after doing runserver, 127.0.0.1:8000/customer/2/ give this i think you have forgot to give primary key value /2/ or etc.....

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

    i am following the tutorial and on this particular video i keep getting an error that says:'Customer' object has no attribute 'order_set'.

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

      I know how frustrating it can be. And I am having my share of errors as well. Just download the source code and compare it to yours. It is tedious work but it will help you.

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

      Hi Jacob, this can happen depending what IDE you are using. I was using PyCharm Community Edition 2018 and had this issue. Once I updated to the 2020 it was fixed. I believe it has to do with the level of support for Django within the IDE.

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

      Maybe you have different class name for order model . Something like class OrderModel() instead of class Order() ,but while writing query you have used order_set.

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

      i had the same error, my mistake was i wrote order.set instead of order_set. Check ur code.

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

      i reading this comments but no one say if u named ur class CustomerModel u need to use ordermodel_set

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

    I am getting an error can you help me out. Its saying customer() got an unexpected keyword argument 'pk_test'

    • @gg-vl2xw
      @gg-vl2xw 4 ปีที่แล้ว

      do you find the solution?

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

      please show us ur code, if you just say that, could be many things, apparently is something with pk_test check that is the same in all places. One of the skills of a programmer is to debug his/her own code, so, give it a try next time. Try to go back and forth, change things, double check that all the things are written correctly, possible copy the error and look for it in stackoverflow or github, for sure someone had the same error than u did. Let me know later!
      this is my views.py
      def customer(request, pk_tes):
      #customer = Customer.objects.get(id=pk_test)
      return render(request, 'accounts/customer.html')
      this is my urls.py
      urlpatterns = [
      path('', views.home),
      path('products/', views.products),
      #make path dynamic by adding

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

      You must add pk_test as parameter at customer in views.py

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

      @@julianbazanaguirre8439 def customer(request,pk_test) change it to this

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

    plz whare in find attribute order_set thanks

    • @AshuSingh-mw2wt
      @AshuSingh-mw2wt 4 ปีที่แล้ว +1

      stackoverflow.com/questions/42080864/set-in-django-for-a-queryset

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

    How can I create a personalized URL for every user, for example I have this: www.mywebsite.com/profile and I want something like this www.mywebsite.com/user... I mean www.mywebsite.com/john, www.mywebsite.com/luisa etc. How can I do that?

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

    orders=customer.order_set.all() showing error for me..plz help me sir..

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

      hey, its showing me the same error, did you find any solution to it?

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

    pliz answer urgently

  • @EOO-Stand
    @EOO-Stand 4 ปีที่แล้ว

    excellent teaching, do you have a paypal account where people can buy you coffee. i have seen a few youtube videos with accounts.

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

    hi sir i have one error can you help me

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

      Is your error solved?

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

      @@waqarshaikh716 no
      could you hel me

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

      @@farsanaks5672 Sure, I'll try to help you.

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

      @@waqarshaikh716 i try to write a ecommerce project.the problem is when the project is run first web page is showed but when i click on login and register button that redirect home page. and i try to find the bug but it shows no module named django.but i already install django and use the command pip install django also

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

      @@farsanaks5672 In you Command Prompt or Terminal run this command `pip list`.
      This command will list all the python packages installed in your PC.
      Check if you have Django in that list.

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

    share the codes please

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

      Already linked.

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

      @@DennisIvy got it and thank you for this great course .

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

      @@DennisIvy the link doesn't work

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

    "GET /customer/ HTTP/1.1" 404 2490
    Not Found: /customer/ , this is the error I m getting, every page is getting open admin,about,dashboard,product but customer page is not opening at all ,, if anyone knows how to solve this error ,kindly let me know ..

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

    I am getting an error when I call order_set.all(). "function' object has no attribute 'order_set' ". I am getting this error, what should I do? any suggestions please

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

      def customer(request, pk_test):
      customers = Customer.objects.get(id=pk_test)
      orders = customer.order_set.all()
      context = {'customer':customer,'orders': orders}
      return render(request, 'accounts/customer.html', context)

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

      @@srinivaspendem2826 same problem here

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

      @@jorgecosta1758 me tooooo