▶ Watch Django Wednesdays Ecommerce Playlist ✅ Subscribe To My TH-cam Channel: bit.ly/3OBQJfN bit.ly/2IGzvOR ▶ See More At: ✅ Join My Facebook Group: Codemy.com bit.ly/2GFmOBz ▶ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt! Take 50% off with coupon code: youtube50 bit.ly/2VC9WUN ▶ Get The Code bit.ly/47xAhWJ
Thanks John, from here in the UK. A super tutorial again (just recently found you while trying to make sense of a 5 yr old eccomerce tutorial where all the requirements.txt files were out of date so got a bit lost ha .. a big learning curve in this session for sure but a good feeling when get a 200 server code. Think the JavaScript course is next on the cards! :)
Whoa that was a bit to take in! I literally know nothing about JavaScript so may need to learn more about that, especially when I'm also trying to understand HTMX (not related to your course here) Great work as always John! Off to the next video as I'm a bit behind :D
Great tutorial John, thanks. By the way, anyone having error like this : "TypeError: argument of type 'NoneType' is not iterable" in line > if product_id in self.cart. any idea how to solved it?
I had this problem in ajax(product detail template). So i changed product_id: $('add_cart').val() line for this product_id : '{{ product.id}}'. Hope it will help.
@@multizloy this helped me! I had error ValueError: Field 'id' expected a number but got 'ID: 1'. in CMD. Change to what you provided and fixed it. Thanks!
I was trying to do a pricing section on my website using this, however I faced an issue where no matter what button I clicked for my pricing package. it was always the same ID and name being retrieved, I fixed that with var product_id = $(this).val(); in the script If anyone was facing the same issue .. Thank you for the series. Looking forward for more. You are awesome!
Hey, at 20:15 when i click on the "add to cart" button i get this error in the terminal: ValueError: The view cart.views.cart_add didn't return an HttpResponse object. It returned None instead. I tried to solve this but i have no ideia what i did wrong. Can someone help me?
Hey John, In this tutorial you didn't use login decorators. Anyone can add product to cart and move to billing and payment without even registering. I hope you will address this small issue in upcoming video. You are doing great. Thank you.
Hi John, Thank you very much for your course. I'm having a bit of trouble here. When I click the cart button, there is no response in the network tab. I’ve checked the code and there are no errors or warnings. Could this be due to an issue with my environment configuration?
I encountered an issue, I can't import Product from store.models. Previously, I was able to import Product into the store directory, i am using PyCharm could the problem be related to that?
If someone faced the same import problem as I did, I found a solution, but I'm not 100% sure it's correct since I'm just a student :D from django.apps import apps then ModelName= apps.get_model('dir', 'ModelName')
would it not be better to instead have my product buy form as a django form that posts data to the view, then the view can handle all the data and all the products to the cart, because my products will have further possible variations for some products, that in turn effects the price, furthermore, I also have things like quantity that need to be processed?
John in the admin panel, the admin can change password of ANY user through an option given "this form". can you please teach us how to remove this option for the admin? thanks
Woow, congralutions for tutorial, my friend. I'm from Brazil and I follow you here on TH-cam When will the next video come out changing the view and cart?
In my product.html, I am seeing a error within the JavaScript code on line "url: '{% url 'cart_add' %}',". However, when I run the code on the browser, I am getting a 200 status when clicking on the Add to cart button and the product shows up in the session id within python shell on the terminal. Should I be concerned? I am using VScode as my code editor.
You're getting errors and asking if you should be concerned? Of course you should be concerned...you have an error in your code that needs to be fixed. I can't guess what it is...put it aside for a few days to clear your mind, then compare it to the video code to see what you did differently.
@@haitambainy5571 I put up my problem into stack overflow and got it fixed. If you are using vscode as well, you would just need to install a Django extension into vscode. I typed in Django into the search bar and installed the first one by Baptiste Darthenay. What happened for me is that the JavaScript was correct, as shown by John Elder, but vscode didn't understand it and made the line of code into an error. I was recommended to install a Django or Django template extension. Hope this helps
Hi, I'm also using VScode and getting the same "error". I'm pretty sure this just shows because it's django code where it should be javascript and the editor shits itself. So far i've had no actual issues besides the red line underneath
AMAZING lesson like always. If I may I have a qst, I watched some past playlists and you always used models instead of sessions so my qst is: is it necessary to use sessions and not create a model for carts or is it solely because it can update the value without refreshing the page?
One thing i dont understand is that you are not relating the models (Product and cart in this case) to the user. So in theory with your code, all user would share the same Cart and Product objects! can you please tell me if this is correct?
@@Codemycom thank you I just got resolved with your GitHub thank you very much I watched a lot of videos but your course is special to me you have different way to teach anyone thank you very much
Great tutorial By the way, anyone having error like this : TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' ? pls need help
Guys! Just be careful. The HTML code in almost all the files is bad. He adds this 10 times and it looks very unprofessional so BE CAREFUL when using it as your resume! This is not a GOOD HTML CODE
You either forgot to return anything from your cart_add function, or you do not return a JsonResponse there, or your return is missaligned causing it to belong to an unexpected block.
@@ketilknit was actually in my ajax, it was error when i write like this '{% url 'cart_add' %}', but when i changed it to "{% url 'cart_add' %}" it works
@@FadhelMuhammad-u7o thanks - i had the ' parenthesis instead of " too - spotted everything up to this point but that session was one steep learning curve haha
▶ Watch Django Wednesdays Ecommerce Playlist ✅ Subscribe To My TH-cam Channel:
bit.ly/3OBQJfN bit.ly/2IGzvOR
▶ See More At: ✅ Join My Facebook Group:
Codemy.com bit.ly/2GFmOBz
▶ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt!
Take 50% off with coupon code: youtube50 bit.ly/2VC9WUN
▶ Get The Code
bit.ly/47xAhWJ
Thanks John, from here in the UK. A super tutorial again (just recently found you while trying to make sense of a 5 yr old eccomerce tutorial where all the requirements.txt files were out of date so got a bit lost ha .. a big learning curve in this session for sure but a good feeling when get a 200 server code. Think the JavaScript course is next on the cards! :)
Glad you're enjoying it! Yeah this one was a bit tougher than usual!
Whoa that was a bit to take in! I literally know nothing about JavaScript so may need to learn more about that, especially when I'm also trying to understand HTMX (not related to your course here) Great work as always John! Off to the next video as I'm a bit behind :D
awesome
Good Morning
Thank you, i had some issues with the concept of cookies and sessions
Now i got
Just finished #13
Waiting for #14 next week
I have a problem bro
Awesome series! can't wait to next wednesday!
glad you're enjoying it!
Great tutorial John, thanks.
By the way, anyone having error like this :
"TypeError: argument of type 'NoneType' is not iterable" in line > if product_id in self.cart. any idea how to solved it?
I had this problem in ajax(product detail template). So i changed product_id: $('add_cart').val() line for this product_id : '{{ product.id}}'. Hope it will help.
thanks man) you save me )@@multizloy
@@multizloy this helped me! I had error ValueError: Field 'id' expected a number but got 'ID: 1'. in CMD. Change to what you provided and fixed it. Thanks!
I was trying to do a pricing section on my website using this, however I faced an issue where no matter what button I clicked for my pricing package. it was always the same ID and name being retrieved, I fixed that with var product_id = $(this).val(); in the script
If anyone was facing the same issue ..
Thank you for the series. Looking forward for more. You are awesome!
Nice, glad you got it sorted out!
thanks man!! you saved my time
Hey, at 20:15 when i click on the "add to cart" button i get this error in the terminal: ValueError: The view cart.views.cart_add didn't return an HttpResponse object. It returned None instead.
I tried to solve this but i have no ideia what i did wrong. Can someone help me?
You made a mistake in your code. Check it vs the video to see what.
@@CodemycomI found the problem, I had written something wrong
Is anyone else getting a namespace or reverse error in the url within the code? My vscode is saying it needs a "," at the end of the url.
if your code is identical to mine, you won't get any errors.
Hey John, In this tutorial you didn't use login decorators. Anyone can add product to cart and move to billing and payment without even registering. I hope you will address this small issue in upcoming video.
You are doing great. Thank you.
Just throw an:
if request.user.is_authenticated and request.user.is_superuser:
Into your view...no biggie.
عالی👍امیدوارم موفق باشی😊ادامه بده
Hi John,
Thank you very much for your course. I'm having a bit of trouble here. When I click the cart button, there is no response in the network tab. I’ve checked the code and there are no errors or warnings. Could this be due to an issue with my environment configuration?
No, you just typed the code wrong somewhere
@@Codemycom Thank you, John, I have founded the misstake in my code, just Cart change to cart. the problem is solved.
I encountered an issue, I can't import Product from store.models. Previously, I was able to import Product into the store directory, i am using PyCharm could the problem be related to that?
If someone faced the same import problem as I did, I found a solution, but I'm not 100% sure it's correct since I'm just a student :D from django.apps import apps
then ModelName= apps.get_model('dir', 'ModelName')
On the Jsonresponse line I get TypeError: Object of type set is not JSON serializable
Review your code vs. the video to determine you did differently.
would it not be better to instead have my product buy form as a django form that posts data to the view, then the view can handle all the data and all the products to the cart, because my products will have further possible variations for some products, that in turn effects the price, furthermore, I also have things like quantity that need to be processed?
huh?
I have a problem bro ... I don't get any errors and concole doesn't show anything either this code
What's the problem then?
Error is : jquery-3.7.1.min.js:2
POST 127.0.0.1:8000/product/%7B%%20url%20'cart_add'%20%%7D 404 (Not Found)
This error
I have a problem of cart/add ,I watch three to four time but problem not solve it@@Codemycom
John in the admin panel, the admin can change password of ANY user through an option given "this form". can you please teach us how to remove this option for the admin? thanks
No, we want the admin to have that ability. That's what it means to be the Admin.
alright thanks for clearing that up :) @@Codemycom
If I log out, it will be gone, right?
What do people usually use for cart models or sessions?
Yes, we'll build permanence later in the playlist.
I'm get the value error in cart/add and not shown the console in browser
check your code for errors
Woow, congralutions for tutorial, my friend. I'm from Brazil and I follow you here on TH-cam
When will the next video come out changing the view and cart?
The series is called Django Wednesdays
What if I want to install jQuery in my virtual environment, what do I do
Add it to a js directory in a static directory and call it using the regular static django method
In my product.html, I am seeing a error within the JavaScript code on line "url: '{% url 'cart_add' %}',". However, when I run the code on the browser, I am getting a 200 status when clicking on the Add to cart button and the product shows up in the session id within python shell on the terminal. Should I be concerned? I am using VScode as my code editor.
i have the same probleme
You're getting errors and asking if you should be concerned? Of course you should be concerned...you have an error in your code that needs to be fixed. I can't guess what it is...put it aside for a few days to clear your mind, then compare it to the video code to see what you did differently.
@@haitambainy5571 I put up my problem into stack overflow and got it fixed. If you are using vscode as well, you would just need to install a Django extension into vscode. I typed in Django into the search bar and installed the first one by Baptiste Darthenay. What happened for me is that the JavaScript was correct, as shown by John Elder, but vscode didn't understand it and made the line of code into an error. I was recommended to install a Django or Django template extension. Hope this helps
Hi, I'm also using VScode and getting the same "error". I'm pretty sure this just shows because it's django code where it should be javascript and the editor shits itself. So far i've had no actual issues besides the red line underneath
@@americahater2 no clue, I'd never use vscode for python
AMAZING lesson like always. If I may I have a qst, I watched some past playlists and you always used models instead of sessions so my qst is: is it necessary to use sessions and not create a model for carts or is it solely because it can update the value without refreshing the page?
We will use models for logged in users to save their cart to the database, but sessions for people who aren't logged in
One thing i dont understand is that you are not relating the models (Product and cart in this case) to the user. So in theory with your code, all user would share the same Cart and Product objects!
can you please tell me if this is correct?
No, it's not correct.
I am get an error just in this video add/ 500 xhr
what's the exact error?
@@Codemycom thank you I just got resolved with your GitHub thank you very much I watched a lot of videos but your course is special to me you have different way to teach anyone thank you very much
John pls am having error in adding to cart
Saying can't convert my request from product Id to integer
You have a typo in your code. Read thru the comments to see that others did too...and how to fix.
And is there a way to use only python language without using jquery cause some of us don't have knowledge on it
no. But I teach you everything you need in this video, so you do have the knowledge you need.
Can I just use fetch instead of jQuery
If you have to ask, then probably no
till this video i was going smooth but now facing difficulty in getting these concepts.. i think i need to learn javascript and more about sessions
great as always.
Thanks!
@@Codemycom Do you have a telegram?
thanks a lot
Hi best one ever
Thanks!
where is you'r github link
In the pinned comment, like I said in the video.
Amazing
thanks!
Great tutorial
By the way, anyone having error like this : TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' ? pls need help
you just have a typo somewhere...compare your code to the video to discover it
O.K. From this point it's a little bit voodoo .... 😧 - but I keep going on ....
ha
agree!
Guys! Just be careful. The HTML code in almost all the files is bad. He adds this 10 times and it looks very unprofessional so BE CAREFUL when using it as your resume! This is not a GOOD HTML CODE
💚💚💚💚
🙂
I got this error
"The view cart.views.cart_add didn't return an HttpResponse object. It returned None instead."
can you help?
You either forgot to return anything from your cart_add function, or you do not return a JsonResponse there, or your return is missaligned causing it to belong to an unexpected block.
thank you@@ketilkn
@@FadhelMuhammad-u7o What was the mistake?
@@ketilknit was actually in my ajax, it was error when i write like this '{% url 'cart_add' %}', but when i changed it to "{% url 'cart_add' %}" it works
@@FadhelMuhammad-u7o thanks - i had the ' parenthesis instead of " too - spotted everything up to this point but that session was one steep learning curve haha
Error during template rendering
In template C:\Users\d\django\ecom\store\templates\product.html, error at line 75
'cart' is not a registered namespace
65
66
67
68
69
70 // Check if button pressed
71 $(document).on('click', '#add-cart', function(e){
72 e.preventDefault();
73 $.ajax({
74 type: 'POST',
75 url: '{% url 'cart:cart_add' %}',
76 data: {
77 product_id: $('#add-cart').val(),
78 product_qty: $('#qty-cart option:selected').text(),
79 csrfmiddlewaretoken: '{{ csrf_token }}',
80 action: 'post'
81 },
line 75 should be: url: '{% url 'cart_add' %}',
not cart:cart_add
i dont know how but i keep getting the same error. it seems the html tags cant read from the cart app@@Codemycom