Python Tutorial // Build a Digital Shopping Cart with Django
ฝัง
- เผยแพร่เมื่อ 7 ก.พ. 2025
- ***
Please note this video is over two years old. I've left it up for those of you who might get value from it but be aware that packages update and things change. It could not work for you and that might just be because the tech has changed by now.
We have a recently created (2020) course on our website that covers e-commerce more in-depth. It is a paid course but the value you get is much more than this old tutorial. If you're interested check out learn.justdjan...
Thanks for your understanding!
***
In this Django project, we teach you how to build a digital shopping cart with Django. In the follow up of this video we’ll be adding payments.
justdjango.com
☝ Get exclusive courses & become a better Django developer
💻 Project code: github.com/jus...
✌️ Stay in touch
Instagram: / justdjangocode
Twitter: / justdjangocode
Email: matt@justdjango.com
Thank you for watching and don't forget to subscribe :)
Some of the links to documentation for code in this project:
1. How to add an object to a manytomany field -
docs.djangopro...
2. How to add many objects to a manytomany field -
stackoverflow....
3. Django Messages Framework - docs.djangopro...
***
Please note this video is over two years old. I've left it up for those of you who might get value from it but be aware that packages update and things change. It could not work for you and that might just be because the tech has changed by now.
We have a recently created (2020) course on our website that covers e-commerce more in-depth. It is a paid course but the value you get is much more than this old tutorial. If you're interested check out learn.justdjango.com
Thanks for your understanding!
***
Best Video Have been looking for How E-shops are made for digital products this is just okay! Keep up the good work.
This tutorial deserves more credit, this is GREAT!
Thanks you!
Very Informative.
I decided to learn Python and Django a couple of months ago.
Completed some Udemy courses and found your videos to cover real world examples and implementations. Extra thumbs up for being a fellow South African :-).
Great work!
Sir I want to thank you a lot for your videos it has helped learn a lot ! On the Internet this is the best ever Django tutorials I have across. Thanks a lot
Wow man.. You are really going to make my Django development strong.. Thank you very much..
Thank you sir this is exactly i was looking for!!!!
your tutorials are awesome, keep it up thank you very much
Why do you use Product.objects.filter(condition).first() instead of a simple Product.objects.get(condition)?
Great video. Please make a tutorial on a Full e-commerce project on Django.
Thank you. Hopefully I’ll have it up soon
Great tutorial, I'm a beginner, why use multiple apps rather then for example: both products and cart in the same app ?
For what I understood it's better to have a clear function for every app. In that way you can easily integrate it in another project, and the total project stays more clear when you have a bigger project.
Hello, Please can you create a full tutorial on Django E-commerce store with payment integrated. Please. I really love your channel
Nice, Thanks
Nice video
Which version of django did you use?
is there any specific reason why we are using the "filter().first()" instead of a "get" query when we surely know there will be only one entry?
I have an issue here anytime I do order=Order.objects.get(user=request.user)
then order.items.all() there is an error Queryset objext has no attribute items
Hi, What is the django version used here ?
you should do a part 3 of the ebook and were it lets them read the book or video
The URL patterns are obviously for 1.x django. won't work in django 2. why you require django 2.2 in requirements.txt?
Thanks a lot!
so my question is :
i have a ecommerce chatbot on messenger (using chatfuel) , i want to build a shopping cart that retreive data from a google sheet ( which contains the products information) and display them in this shopping cart and the user can add and remove items from this shopping cart but i dont save his cart, i mean the moment he click checkout on the shopping cart i get the items he added as text to my bot and show them as message
i dont know if it is something doable
Could we just add information to a database and loop through how many lines of information in the base and display that number near the shop or cart symbol?
Yas Yes Yes!!!! thank you for this tutorial
Awesome, its a great explanation about django. keep going on , and i will be pleasant if u make a django group model tutorial for (like facebook group).... thanks a lot
Thanks for the comment. I’ll look into it
Guys, what's the Python version used here ?
One question for this part : current_order_products = [product.product for product in user_order_items]
where exactly are you geting product.product because I know there is a Model called product but not a field called product
thanks again
If you just print out product for product in user_order_items it gives you a list of items in the users current order. The word product is just use to iterate through the list. It’s not referencing the product model. I should’ve made that line [item.product for item in user_order_items]. Because the word item is used to loop through the list. But by calling item.product you get the product associated with the item
@JustDjango can you help me out adding/ registration of users and authenticating them?
The documentation says on_delete is for when the referenced object is deleted. This would mean that when the Profile is deleted, the Order would be deleted.(assuming on_delete=models.CASCADE) Not that the Profile would be deleted when the Order is deleted, as stated in the video. Does anyone have more experience that can confirm this?
These are great tutorials. I just want to be sure of what this argument does.
Yes you’re right about this. Got the words mixed up
Awesome, that really clears things up. Thanks for the fast reply!
Hi Thanks for the tutorial, was what i was looking for. Am stuck on how to extend it to make sure a user can be able to increase the number of books they are shopping for. Like another button besise the delete item where a user can increase the number of books shopped-- basically how a normal shopping cart would look like. Any ideas? thanks
beside not besise
is it okay to not exist forms.py?
thanks solved it
Which one is better.. Python or ASP.Net? 😒
After getting the code from repo, I am getting "Not Found: /". What can be the issue ?
me to waiting for response someone help
syntax error prolly
how would you implement a reorder for the item?
Hi, can all this be achieved using classed based views as well?
Yes it can
Why items = models.ManyToManyField(OrderItem)?
Because one order contains many orderitems you want to use a manytomanyfield
JustDjango no, OrderItem should have a foreign key to order. Plus, once you change products price it will also change orders overall price ;)
In add_to_cart function
' ' ' if product in request.user.profile.ebooks.all( ) ' ' '
Error:
'QuerySet' is not iterable.
What is the problem??
Great tutorial anyway!
Have you checked the code on GitHub?
Yes!
What can be the alternative for queryset ' ' ' request.user.profile.ebooks.all( ) ' ' ' ?
nice make another one to store order.
Is there a follow-up of payments integration for this video ?
Here is the playlist -> th-cam.com/video/vccUP3jdpBg/w-d-xo.html
@@mattfreire This is the same video. I'm looking for the payments integration video with services like paypal, payu, strip etc. You mention it in the video that it will be the next video.
@@shantanusharma8972 2 videos in the playlist show how to use stripe and braintree respectively. Unfortunately we're not able to show every payment method right now.
@@mattfreire I think both the methods are merged in one project, so it's hard to understand, and it is complex.
please I need the git url.thanks
Sir python e-commerce website pae video banaye
Hey you doing good 👍
Hi. This tutorial is the best! I just want to ask a question. I raised an error on product = Product.objects.filter(id=kwargs.get('item_id', "")).first() which is ValueError at /cart/5/
invalid literal for int() with base 10: ' i have checked on many answers but still not fixed it. what causes this? Thanks!
did you figure out what was wrong?
AttributeError at /cart/^add-to-cart/(?P2[-\w]+)/$
'Profile' object has no attribute 'ebooks' thats the error i get when i add an item to the cart?
what install the git version i get braintree.exceptions.configuration_error.ConfigurationError: Missing merchant_id
I got that too, did you figure it out?
why do we need 'is_ordered' in OrderItem ?
It helps for filtering orderitems to see when something has been ordered or not
are we using this filter somewhere? because when the transaction is completed we are setting 'is_ordereed' to true and every incomplete order will have 'is_ordered' false for OrderItems . or is it for a future development option?
It was just for demonstrating the concept
thanks a lot for the reply. :)
A sub from me! You deserve it!!
Hey Everyone I have dropped another video on TH-cam about Input and Output operation in Python. Check out with this link:- th-cam.com/video/Asap1SRlnSQ/w-d-xo.html
Do a video on integrating React/Angular with Django!
When I can expect the video to be uploaded?
I’m not experienced enough with react so probably not any time soon. There are some tutorials by Max Goodridge on using react so check out some of his stuff
Okay!
Can you do on Social Authentication!
Please use Django 2.0 :)
sir can u share wtih me our codes ? plsss
What is secret key ??
I got a Profile has not attribute ebooks error
Have you checked your code with the code of the project on GitHub?
JustDjango yep silly error I had forgot to put ebooks as a field thanks
Your tutorial is interesting but you are explaining nothing. It's too bad to don't take in consideration some people will start this tutorial.