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...

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

  • @mattfreire
    @mattfreire  4 ปีที่แล้ว +6

    ***
    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!
    ***

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

    Best Video Have been looking for How E-shops are made for digital products this is just okay! Keep up the good work.

  • @dominicmazzola1057
    @dominicmazzola1057 6 ปีที่แล้ว +4

    This tutorial deserves more credit, this is GREAT!

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

    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!

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

    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

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

    Wow man.. You are really going to make my Django development strong.. Thank you very much..

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

    Thank you sir this is exactly i was looking for!!!!

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

    your tutorials are awesome, keep it up thank you very much

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

    Why do you use Product.objects.filter(condition).first() instead of a simple Product.objects.get(condition)?

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

    Great video. Please make a tutorial on a Full e-commerce project on Django.

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

      Thank you. Hopefully I’ll have it up soon

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

    Great tutorial, I'm a beginner, why use multiple apps rather then for example: both products and cart in the same app ?

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

      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.

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

    Hello, Please can you create a full tutorial on Django E-commerce store with payment integrated. Please. I really love your channel

  • @manish15711
    @manish15711 6 ปีที่แล้ว

    Nice, Thanks

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

    Nice video

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

    Which version of django did you use?

  • @doubleo4656
    @doubleo4656 6 ปีที่แล้ว

    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?

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

    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

  • @asthaprasad7376
    @asthaprasad7376 6 ปีที่แล้ว

    Hi, What is the django version used here ?

  • @Zzzzzzzzzzzzzzzzzzzzr
    @Zzzzzzzzzzzzzzzzzzzzr 6 ปีที่แล้ว

    you should do a part 3 of the ebook and were it lets them read the book or video

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

    The URL patterns are obviously for 1.x django. won't work in django 2. why you require django 2.2 in requirements.txt?

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

    Thanks a lot!

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

    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

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

    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?

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

    Yas Yes Yes!!!! thank you for this tutorial

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

    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

    • @mattfreire
      @mattfreire  6 ปีที่แล้ว

      Thanks for the comment. I’ll look into it

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

    Guys, what's the Python version used here ?

  • @Zzzzzzzzzzzzzzzzzzzzr
    @Zzzzzzzzzzzzzzzzzzzzr 6 ปีที่แล้ว

    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

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

      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

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

    @JustDjango can you help me out adding/ registration of users and authenticating them?

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

    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?

    • @taylerallen7841
      @taylerallen7841 6 ปีที่แล้ว

      These are great tutorials. I just want to be sure of what this argument does.

    • @mattfreire
      @mattfreire  6 ปีที่แล้ว

      Yes you’re right about this. Got the words mixed up

    • @taylerallen7841
      @taylerallen7841 6 ปีที่แล้ว

      Awesome, that really clears things up. Thanks for the fast reply!

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

    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

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

      beside not besise

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

    is it okay to not exist forms.py?

  • @Zzzzzzzzzzzzzzzzzzzzr
    @Zzzzzzzzzzzzzzzzzzzzr 6 ปีที่แล้ว

    thanks solved it

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

    Which one is better.. Python or ASP.Net? 😒

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

    After getting the code from repo, I am getting "Not Found: /". What can be the issue ?

  • @Zzzzzzzzzzzzzzzzzzzzr
    @Zzzzzzzzzzzzzzzzzzzzr 6 ปีที่แล้ว

    how would you implement a reorder for the item?

  • @niteshrawat576
    @niteshrawat576 6 ปีที่แล้ว

    Hi, can all this be achieved using classed based views as well?

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

    Why items = models.ManyToManyField(OrderItem)?

    • @mattfreire
      @mattfreire  6 ปีที่แล้ว

      Because one order contains many orderitems you want to use a manytomanyfield

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

      JustDjango no, OrderItem should have a foreign key to order. Plus, once you change products price it will also change orders overall price ;)

  • @milanale5768
    @milanale5768 6 ปีที่แล้ว

    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!

    • @mattfreire
      @mattfreire  6 ปีที่แล้ว

      Have you checked the code on GitHub?

    • @milanale5768
      @milanale5768 6 ปีที่แล้ว

      Yes!
      What can be the alternative for queryset ' ' ' request.user.profile.ebooks.all( ) ' ' ' ?

  • @denismurithi4453
    @denismurithi4453 6 ปีที่แล้ว

    nice make another one to store order.

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

    Is there a follow-up of payments integration for this video ?

    • @mattfreire
      @mattfreire  6 ปีที่แล้ว

      Here is the playlist -> th-cam.com/video/vccUP3jdpBg/w-d-xo.html

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

      @@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.

    • @mattfreire
      @mattfreire  6 ปีที่แล้ว

      @@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.

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

      @@mattfreire I think both the methods are merged in one project, so it's hard to understand, and it is complex.

  • @toochinkuzi6536
    @toochinkuzi6536 6 ปีที่แล้ว

    please I need the git url.thanks

  • @ecommerceupdates2281
    @ecommerceupdates2281 6 ปีที่แล้ว

    Sir python e-commerce website pae video banaye

  • @adityabohra6991
    @adityabohra6991 6 ปีที่แล้ว

    Hey you doing good 👍

  • @awfuldesigns
    @awfuldesigns 6 ปีที่แล้ว

    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!

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

      did you figure out what was wrong?

  • @Zzzzzzzzzzzzzzzzzzzzr
    @Zzzzzzzzzzzzzzzzzzzzr 6 ปีที่แล้ว

    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?

  • @timvogt7088
    @timvogt7088 6 ปีที่แล้ว

    what install the git version i get braintree.exceptions.configuration_error.ConfigurationError: Missing merchant_id

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

      I got that too, did you figure it out?

  • @doubleo4656
    @doubleo4656 6 ปีที่แล้ว

    why do we need 'is_ordered' in OrderItem ?

    • @mattfreire
      @mattfreire  6 ปีที่แล้ว

      It helps for filtering orderitems to see when something has been ordered or not

    • @doubleo4656
      @doubleo4656 6 ปีที่แล้ว

      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?

    • @mattfreire
      @mattfreire  6 ปีที่แล้ว

      It was just for demonstrating the concept

    • @doubleo4656
      @doubleo4656 6 ปีที่แล้ว

      thanks a lot for the reply. :)

  • @mrturnables1
    @mrturnables1 6 ปีที่แล้ว

    A sub from me! You deserve it!!

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

    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

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

    Do a video on integrating React/Angular with Django!

    • @Thesrik23
      @Thesrik23 6 ปีที่แล้ว

      When I can expect the video to be uploaded?

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

      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

    • @Thesrik23
      @Thesrik23 6 ปีที่แล้ว

      Okay!
      Can you do on Social Authentication!

    • @Thesrik23
      @Thesrik23 6 ปีที่แล้ว

      Please use Django 2.0 :)

  • @biroldemirtas21
    @biroldemirtas21 6 ปีที่แล้ว

    sir can u share wtih me our codes ? plsss

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

    What is secret key ??

  • @Zzzzzzzzzzzzzzzzzzzzr
    @Zzzzzzzzzzzzzzzzzzzzr 6 ปีที่แล้ว

    I got a Profile has not attribute ebooks error

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

      Have you checked your code with the code of the project on GitHub?

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

      JustDjango yep silly error I had forgot to put ebooks as a field thanks

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

    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.