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 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
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.
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.
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 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 :)
@@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
@@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
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!
@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.
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.
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 ??
@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.
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.
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.
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
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.
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()
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
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?
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.
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.
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.
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
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?
@@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
@@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.
"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 ..
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
Don't forget to check out my Complete Django course! dub.sh/NvGboTI
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!
Glad it was helpful!
@@DennisIvy Honestly, you helped me a lot with this question as well! Thanks)))
That was my biggest question too!
@@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
Far better than All udemy courses keep it up 🔥
Best channel on TH-cam for Django
:)
This is so far the best tutorials ever man!!!!!!!!!!!!!!! And its free!!!!!!!!!!!! Big respect from BANGLADESH
well explained, Thanks again for sharing ur knowledge. Making crash course with a project is a great idea better than explaining stuff separately
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.
If yall get this error "object is not iterable"
use filter() instead of get()
Thanks Dennis. your course is better than Udemy django course👏😏
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.
Thanks a lot , this is the best way of teaching I had seen, You are the treasure we must keep!❤👌🌹
The Best Tutorial!!!
Thank you!
Dennis Ivy you are the best
thanks man, definitely the best tutorial ever, had so much fun
You are amazing Dennis
I found it very useful I just enjoyed understanding from your explanation, Thanks so much and will wait such courses again!
Helped me in my project. Thanks for the video buddy.
Thank you Dennis! This course is really helping me a lot.
Thank you Dennis for this great course. It is helping me a lot.
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.
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..
@@DennisIvy Please change id to uuid, it would be better and more relevant to the document DB and will survive ;-)
@@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 :)
@@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
@@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
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
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 iam getting the same error toooo 😭😭😭😭
Excellent course
13/07/2020
This is awsome man. Thanks for sharing your knowledge for free
thanks mate exactly what I needed
Thank you so much! The best tutorial ever!
this tutorial is so so good it has helped me alol
Dear Dennis, thanks for making such good videos.
Thanks,
hi im a bit curious on how to use it in an tag in html. can you show me? i would deeply appreciate it
thanks alooot for these videos really helpfull ♥
Wow enjoy watching ur totorials
That is awesome!! Thanks!
@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.
Same here did u solve it?
@@aslamkhan-xd1jz not yet, I’m trying to read django doc to find it out
@@tiagotitericz3654 Hey , did you figured out ?
@@Raul-tw2xx not yet, If I get it I’ll tell you 😉
Wow... This was really amazing .
Very nice tutorial, exactly what I was looking for. Thanks; I've subscribed. God Bless. : D
U r awesome😘
I mean i'm really getting a hang of this and it's so much fun😊
how can i redirect to a dynamic url
great video , thanks .
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.
@Vladimir Terentev hello! I tried to use this but I can't figure out,
how did you use that code?
Thank you!
Well explained...
bro make tutorial about import UUIDField
ty
what if i get an error like NoReverseMatch at /students/3/ what should i do now
Thankq so much..................:)
What if i want to search the customer from form input field..how can redirect that url
i want individual customer ,order date ,status table in single page how can i do that ?
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 ??
i dont understand it too if have understand it so can u explain me please..
You use {{order.product.category}} if you are accessing the parent model, and customer.order_set.all() when trying to get the child model.
@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.
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.
FYI .... I noticed that line 10 in customer.html is missing {{ customer }} to put the customer name in the top left panel. Cheers
Urgent answer please!
i want to grab the loggedin user user_id .
model is --> Profile (user,email,pic,website)
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.
I'm confused about 'order_set', 4:17 , can you please mention where u have introduced it?
u can check Database Model Queries in previous video
@@rijalefendi6465 iam getting the same error too ...please help
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
getting attribute error in customer page
In line 9 of customer.html he missed including {{customer.name}} to complete the form.
The link to the source code is not working. Could you please fix this, Dennis?
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
check your url.py file. You would have made some mistake there..
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.
@@tiagotitericz3654 did you solve it? As i m facing the same issue.
I have a problem with the contact information the email and phone do not appear on my website.
can you help me with that?
do you find the solution?
i dont undserstand order_set pls help me
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)
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
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?
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.....
i am following the tutorial and on this particular video i keep getting an error that says:'Customer' object has no attribute 'order_set'.
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.
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.
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.
i had the same error, my mistake was i wrote order.set instead of order_set. Check ur code.
i reading this comments but no one say if u named ur class CustomerModel u need to use ordermodel_set
I am getting an error can you help me out. Its saying customer() got an unexpected keyword argument 'pk_test'
do you find the solution?
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
You must add pk_test as parameter at customer in views.py
@@julianbazanaguirre8439 def customer(request,pk_test) change it to this
plz whare in find attribute order_set thanks
stackoverflow.com/questions/42080864/set-in-django-for-a-queryset
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?
orders=customer.order_set.all() showing error for me..plz help me sir..
hey, its showing me the same error, did you find any solution to it?
pliz answer urgently
excellent teaching, do you have a paypal account where people can buy you coffee. i have seen a few youtube videos with accounts.
hi sir i have one error can you help me
Is your error solved?
@@waqarshaikh716 no
could you hel me
@@farsanaks5672 Sure, I'll try to help you.
@@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
@@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.
share the codes please
Already linked.
@@DennisIvy got it and thank you for this great course .
@@DennisIvy the link doesn't work
"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 ..
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
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)
@@srinivaspendem2826 same problem here
@@jorgecosta1758 me tooooo