Python Django - Build an ecommerce basket with session handling

  Рет қаралды 76,814

Very Academy

Very Academy

Күн бұрын

Пікірлер: 276
@youssefammen5025
@youssefammen5025 5 ай бұрын
A simplified and detailed explanation of every word in the code, and this is a distinguishing point between all channels❤❤
@daisyktbpa
@daisyktbpa 2 жыл бұрын
You are the best... really (K). The way the you explain is very clearly :) you..explain the "why" of the code. Kisses from Chile.
@leandrocl2006
@leandrocl2006 3 жыл бұрын
I have done many Django Courses, but... I'm sure, this is the best no doubt! Thank you!
@veryacademy
@veryacademy 3 жыл бұрын
Thanks Leandro!
@kiorepaul6278
@kiorepaul6278 3 жыл бұрын
Again... many thanks for these tutorials. My django skills are improving day in day out thanks to them. Shukran
@veryacademy
@veryacademy 3 жыл бұрын
Great to hear! Thank you!
@maxrichard8852
@maxrichard8852 3 жыл бұрын
Amazing tutorial! Thanks a million! And to the next one. Refactoring and testing parts are very much needed. No one virtually talks about them. Thank you for that as well!
@abdullahyaqoob3741
@abdullahyaqoob3741 3 жыл бұрын
I believe you are the best instructor who explain Django from ground level to advance topic. Thanks a lot chief for all the effort you put her👏. Would you please add one more video to add more functionalities to the e-commerce website like changing the language from english to other language and the reverse, secondly adding functionality to change the currency from bounds to US dollar.
@HmKabir1212
@HmKabir1212 Жыл бұрын
Timestamp "3:58:19" as you did, first you added 1, then 2, 3, 4 “and the basket” at the top nav NAV BASKET acted accordingly, updated each time but I tried another way of testing descending, first I added 4 then made the QTY 3 and "add to basket" but basket on top nav menu not updating accordingly, it's staying 4 but it should be 3, if I select 2 from QTY and add to basket the top nav basket should be 2 but it's not happing. It stays as four and if I want to update that QTY I had to do it manually go to the basket and update it. Your project tutorial is very helpful. Your coding is the art of coding. Thanks for the tutorials. @Very Academy
@orhansoyer7450
@orhansoyer7450 2 жыл бұрын
Supeerr course. 💯💯
@whichdude420
@whichdude420 3 жыл бұрын
My man, you be going non-stop lately. Make sure you take breaks bruv
@AcademyOmen
@AcademyOmen 3 жыл бұрын
Haha
@wilmermolina9837
@wilmermolina9837 3 жыл бұрын
Thanks for keeping this course! is just incredible someone can share this knowledge! you are amazing!
@veryacademy
@veryacademy 3 жыл бұрын
No problem, hope to keep making things around here better.
@anassayed314
@anassayed314 3 жыл бұрын
Your in-depth explanation of almost each and every topic throughout the video has helped a lot when facing errors. Thanks a lot for such content. This has been really helpful and useful as i am learning django.
@veryacademy
@veryacademy 3 жыл бұрын
You're very welcome!
@alexandremota6848
@alexandremota6848 3 жыл бұрын
I cannot make the add button to update the JSON with price info... Anyone got the same problem?
@shyamprasad4968
@shyamprasad4968 3 жыл бұрын
4 and a half hours, wow. You won the heart.
@veryacademy
@veryacademy 3 жыл бұрын
Thanks again 👍
@SinanZen1981
@SinanZen1981 3 жыл бұрын
This is a very great course. Thank you. Also, no need to aplogize, you're just great ! :)
@yuriyarin4027
@yuriyarin4027 3 жыл бұрын
I must complement you on the quality of your tutorials. You explain things very well, going meticulously through every part of the code. I particularly like that you zoom in very closely on any code you're working on and that it is easy to see which file you're working on and the code you're editing. You succeed where other fails. I have been following this series and so far finished the first tutorial. I have been making some comments along the way, both for myself and maybe for others to benefit, I hope you don't take them as critique, but rather just notes and a sign that someone has been paying very very close attention to the details.
@veryacademy
@veryacademy 3 жыл бұрын
Thank you Yuri. Honestly, it is music to my ears - any constructive critique is more than welcomed. I am not running, as you probably see from the type of content, a popularity contest - I am genuinely trying to look at how this type of technical knowledge is best presented and delivered in a space such as KZbin. I am still developing, yes I am trying to keep content coming out, the more users I can attract, the more feedback I hope to gather. Over time I hope to iterate over tutorials and fine tune. Any input is most welcomed.
@yuriyarin4027
@yuriyarin4027 3 жыл бұрын
@@veryacademy Great! I'll be looking out for new content and if I think of any useful suggestions, I'll be sure to write a comment
@shaheerzaman620
@shaheerzaman620 3 жыл бұрын
this series is gold!
@veryacademy
@veryacademy 3 жыл бұрын
Thank you Shaheer
@jasonliu9790
@jasonliu9790 3 жыл бұрын
ZANDER IS THE BEST!!! HANDS DOWN!!! I'm still here baby
@greynomadae86
@greynomadae86 2 жыл бұрын
Excellent tutorial series. I particularly like the thorough explanation of what's going. Also the detailed testing sections.
@rajeshs3771
@rajeshs3771 3 жыл бұрын
Great work and undisputed. Well appreciated you best efforts.
@veryacademy
@veryacademy 3 жыл бұрын
Much appreciated
@abdelwahedahmed7622
@abdelwahedahmed7622 2 жыл бұрын
Best, you are well documented about subject
@symphonysalameh5587
@symphonysalameh5587 2 жыл бұрын
i did not understand much the session and ajax code i understood the principal what it does the main goal of session but the code part nope :( is there a video focus on only session and ajax
@veryacademy
@veryacademy 2 жыл бұрын
I haven’t got around to building that yet, but it seems very popular request
@symphonysalameh5587
@symphonysalameh5587 2 жыл бұрын
@@veryacademy yes sir please , i searched KZbin all i found was people explain their code session and each one has a different code, different techniques, a video that cover everything about session would be wonderful. thank you in advance :)
@abhishekdev5251
@abhishekdev5251 3 жыл бұрын
Please re-brand your channel name to Django Guru. I like the way you introduce to engineering concepts like testing, following a styling guide & refactoring. No one does this. You rock. 😄
@banglamaker2993
@banglamaker2993 2 жыл бұрын
u r a wonderful teacher...best of luck💞
@yuriyarin4027
@yuriyarin4027 3 жыл бұрын
1:24:57 The [role="button"] code of a link doesn't actually make it look like a button, it's the part that says [class="btn btn-outline-secondary] that gives the visual effect. [role="button"] only makes it so that people with a screen reader read it. Here's a bit of a simpler code with the same effect: [SVG or icon font code here]
@leiayuri
@leiayuri 3 жыл бұрын
Hello, at some part of the video (01:15:50 Building the basket summary template) you said that there is video which says about (Changing Function into Classes). Could you please share with us. I think it is a good insight.
@veryacademy
@veryacademy 3 жыл бұрын
Hi Yuri, I am building version 2 of this course - actually right at this minute, this will very much be featured in some way.
@leiayuri
@leiayuri 3 жыл бұрын
@@veryacademy That's ok, Thank you 👍
@veryacademy
@veryacademy 3 жыл бұрын
Forgot to mention. Before I put this out I want to get some OOP tutorials out to make understanding it easier.
@tomiwoadejimi19
@tomiwoadejimi19 2 жыл бұрын
Thank you very much for this great work...when I try clicking on the delete button in the server..it shows an error saying int() argument must be a string,a bytes-like object or a real number,not 'None Type'.... Please sir I really need a solution...Thank you God bless
@benjaminandoh8524
@benjaminandoh8524 3 жыл бұрын
hello there, i am a newbie to django and really learning a lot from this tutorial. @18:40 minutes. I know you are getting only active products. what is need help with is the explanation of the "return super(ProductManager, self).get_queryset().filter(is_active=True)". why you were using super, self and get_queryset() just to get the active products couldn't something like "return Product.objects.filter(is_active=True)" work. I will be glad if you could help with the "super".
@phinehasuchegbu8068
@phinehasuchegbu8068 3 ай бұрын
Did you figure it out already?
@rushikeshgandhmal
@rushikeshgandhmal 3 жыл бұрын
Waited for this one 😻 This is exceptional. And yes please make part 3 regarding payment with gmail features. Here's my request, can you please make demo login, where customer can take a tour of website without doing registration ? I really appreciate your efforts that you put in, to make these videos. This are extremely helpful. Such a great content for free, is bless. Thank you so much :)
@veryacademy
@veryacademy 3 жыл бұрын
👍
@Catalin867
@Catalin867 2 жыл бұрын
Hey mate, I believe the material and the course is amazing, but I would like to give you some feedback that will help you attract more people into the course. 1) try to make the website beforehand, start to end, so this way you don't have to spend 50 minutes in the second video just to rename and refactor the 2 hours first course. 2) Try to make smaller videos, I started the video, but I was procrastinating because every time I wanted to continue, I could see there are 2 hours left of the video, and just puts me off. Keep going with the awesome material, and I hope you don't mind the feedback, it is only to give you some of my views as a student.
@veryacademy
@veryacademy 2 жыл бұрын
Thank you for taking the time. I need reminders like this to keep me on track. Appreciate the feedback, please keep it coming.
@RiteshKumar-jq8om
@RiteshKumar-jq8om 3 жыл бұрын
at 2:16:23 i am not able to get price it just return empty dictionary can you help me with this
@amaterasu7532
@amaterasu7532 3 жыл бұрын
Same here. The author passes {{product.price}} into the template and it somehow gets multiplied, when { item.price } is what we need i guess. But multiplication does not work in the __iter__ function. it works, but it doesnt change the price in the session dict.
@largoxx
@largoxx 3 жыл бұрын
did you solve the trouble?
@amaterasu7532
@amaterasu7532 3 жыл бұрын
@@largoxx i solved it,it works with {{item.price}} as i remember
@adventuresofaghanaiangirl
@adventuresofaghanaiangirl 2 жыл бұрын
Ritesh were you able to solve this?
@mariuspaun7001
@mariuspaun7001 3 жыл бұрын
I got the following error: "Status Code: 500 Internal Server Error" when I try to add the product to basket and on form I see is not passing the product ID: productid: csrfmiddlewaretoken: T0q0Pz4Mvz6ICObKb4YFC3KXIKXNew6vVIbnlxu5a0AG674Iu8zubzJ2wLHe4p24 action: post I don't find a solution and Im looking for almost 2 days, any advice will be appreciated. Thanks
@amirroohi4566
@amirroohi4566 3 жыл бұрын
Excellent, just excellent, please keep it up, very educational
@veryacademy
@veryacademy 3 жыл бұрын
Thanks, will do!
@duchuynh7189
@duchuynh7189 3 жыл бұрын
Hope you're doing well during the pandemic. Need to adjust a little bit for this to work with Wagtail, but I want to say thank you for this amazing tutorial!
@veryacademy
@veryacademy 3 жыл бұрын
Hi Duc, we are doing ok, thank you 👍
@GiaBao-nc8ox
@GiaBao-nc8ox 3 жыл бұрын
In 2:18:24 can we use float instead of str, and what should type we use for store data
@BelethKing
@BelethKing 3 жыл бұрын
Does this line at 2:54:00 ''' basket[str(product.id)]['product'] = product '''' is any specific data structure? it kinda confused me at the beginning and how it works so I would like to read more about it. I don't know how to exactly name it to read some more python documentation with examples.
@veryacademy
@veryacademy 3 жыл бұрын
So what is happening is this: 1. We get all the data from the products database based upon the items that are in the basket (line 32,33) 2.We copy the basket basket = self.basket.copy() 3.Now we loop through the items building a new data structure basket[] refers to the new basket data we are going to build str() convert the data to string basket[str( )] now we loop through each item that we got from the database that matched what was in the original basket and add all the data returned from the database basket[str(product.id)] - this is the product id data now we all all the other information collected about each product from the database basket[str(product.id)]['product'] = the product data if you print out the basket you should see something like this {1,{title,price,otherfields..},2,{{title,price,otherfields...}...
@BelethKing
@BelethKing 3 жыл бұрын
@@veryacademy thank you for your response. It just took me a while to realize that what took me so long was that this part here ### basket[str(product.id)]['product'] ### is actually retrieving the value in the subdict by using an additional key. Thats why it looked to me like this dict[key][key] = value and I couldn't come across what this line is doing. and how to name it, what we are actually try to collect. After this part I gotta take ORM course of yours.
@BelethKing
@BelethKing 3 жыл бұрын
@@veryacademy oh okay I get it now, I guess. The part that made confusion was that basket[str(product.id)]['product'] looked like dictionary[key][key] = value , I completely forgot that way we are retrieving the value in the subdictionary by using an additional key.
@CoCo-yz6jh
@CoCo-yz6jh 3 жыл бұрын
Very nice...keep it up 👍🏻🤗
@veryacademy
@veryacademy 3 жыл бұрын
Thanks a lot 😊
@aboutgames8326
@aboutgames8326 3 жыл бұрын
well done, long video tutorial but it's very helpful and respectful, greetings form Egypt
@veryacademy
@veryacademy 3 жыл бұрын
Awesome, thank you!
@GraigRussell
@GraigRussell 3 жыл бұрын
Still really enjoying this! quick question: at around 45:19 you join BASE_DIR to static with os.path, but I've seen just BASE_DIR / 'static' as well. Any reason not to use the latter? Thanks!
@veryacademy
@veryacademy 3 жыл бұрын
If you look on line 4 of your settings.py file you should see: BASE_DIR = Path(__file__).resolve(strict=True).parent.parent I think this is a new feature found in Django 3.1 - this is effectively creating the base directory for you so now you can add the following and not have to use os. STATIC_ROOT = BASE_DIR /... etc Its a good move and simplifies what is for those new to Django can be a tricky task - setting up static and media files.
@zakiinromania
@zakiinromania 3 жыл бұрын
58:21 No module named 'django.contrib.session'. Why i am facing this error?
@veryacademy
@veryacademy 3 жыл бұрын
Hi, you need to add the session module to the settings.py file
@kmachappy5176
@kmachappy5176 2 жыл бұрын
Is the method for self.session.modified really necessary you're just adding more abstraction . Also for the removing of item why over complicate it by modifying the dom when you can just refresh the page on a success plus it also refreshes your session while updating all the other values in the page.
@mohamedstohy
@mohamedstohy 2 жыл бұрын
Thank you so much.I just can't get the significance of " basket = self.basket.copy() ".Why wouldn't we make changes to the original basket,why do we make a copy ?I repeated the video many times and tried doing it with and without this line but still can't get why would I think of writing this line of code.
@Borzy247
@Borzy247 3 жыл бұрын
This is so good!! Thanks for the amazing tutorial
@veryacademy
@veryacademy 3 жыл бұрын
You're so welcome!
@guidomedina5834
@guidomedina5834 3 жыл бұрын
Maybe you can help me. I'm following the tutorial and i'm stuck. After defining the __len__() function in the Basket class, and using it in the views as basketqty = basket.__len__(), and returning the JsonResponse with 'qty':basketqty, i get a 500 error and i can't seem to fix it. If i don't use the __len__ function Ajax seems to work fine with updating the number on the cart icon, so the POST works, but when i add the __len__() function to the equation it fails. I have followed your tutorial step by step. Any ideas on what may be causing me this issue? It says that "return sum(item['qty'] for item in self.basket.values())" TypeError: 'int' object is not subscriptable (My issue starts around 2:37:10)
@veryacademy
@veryacademy 3 жыл бұрын
Hi Guido - best option in Discord private chat send me a link to a github repository so I can download and fix it 👍 - Let me know if you need additional help with that
@guidomedina5834
@guidomedina5834 3 жыл бұрын
@@veryacademy I'll give it one more shot later and if i can't fix it i'll go with the github alternative, thank you!
@Borzy247
@Borzy247 3 жыл бұрын
@@guidomedina5834 I am having the same problem sadly... lemme know if you find a fix, I am 98% sure my code is the same as the repo
@speiro8082
@speiro8082 3 жыл бұрын
If you haven't fixed this already, or if new viewers like me are having issues. My problem was I wasn't clearing my cookies after each code addition like being shown in the tutorial. Once I cleared my site's cookies the error went away.
@laluchademeche
@laluchademeche 3 жыл бұрын
@@speiro8082 muchísimas gracias, esta respuesta me funciono
@xxmonopowerxx2360
@xxmonopowerxx2360 Жыл бұрын
input quantity with value default 1 is better than selecting quantity option. this is better for user experience. edited: adding this in the basket is more easier than runing if statement : {{ basket|length|default:0 }}
@rakib17874
@rakib17874 3 жыл бұрын
Awesome Content ....Man. Much respect for these videos.
@veryacademy
@veryacademy 3 жыл бұрын
Much appreciated
@teddyagudogo3482
@teddyagudogo3482 3 жыл бұрын
Hi, please im not getting the price and after implementing the ajax in the basket page. 2:16:51 of the video pls the response i get in the console when decoding the session data is {'skey': {}, '_auth_user_id': '1', '_auth_user_backend': 'django.contrib.auth.backends.ModelBackend', '_auth_user_hash': '9dadc8cc5d5e838fcd7d3b0f2f8d9afd94e5d364a17cb8bc433a59e94a39c38c'}. Need help with this
@bartoszbienczyk2137
@bartoszbienczyk2137 2 жыл бұрын
Did you found the solution?
@itsRemco
@itsRemco Жыл бұрын
@@bartoszbienczyk2137 I fixed it, go to the latest comment
@r.b.3271
@r.b.3271 3 жыл бұрын
Hi ! Firstly thank you very much for all the contents and amazing explanations :-) I have a question at 3:23:50, I didn't understand the use of data-index instead of the value attribute. Why the delete feature isn't working with the value attribute ? Thanks !
@veryacademy
@veryacademy 3 жыл бұрын
www.w3schools.com/tags/att_data-.asp
@veryacademy
@veryacademy 3 жыл бұрын
You could set it up with the value attribute - if it is a value that has no visual representation and you want to simply pass it to JS like we did - then this seems like a good option.
@r.b.3271
@r.b.3271 3 жыл бұрын
@@veryacademy Thank you for your quick reply ! :)
@TomislavMiletic
@TomislavMiletic Жыл бұрын
Great video, thank you. How do you save the products in the cart when you login/logout, so the products stay saved if the order has not been sent?
@guratete
@guratete 2 жыл бұрын
2:40:09 "We are about 4 hrs in now". I want to know what happened to the rest of the content we were supposed to get in the hour...
@coolcrafts3799
@coolcrafts3799 2 жыл бұрын
perfectly explained; many interesting moments thank you!
@ahmadjuuko352
@ahmadjuuko352 3 жыл бұрын
Thanks for the course. I have reached here 16:38 Creating a new custom object manager but the object manager is filtering the inactive items and i have ensured that i follow the same code
@veryacademy
@veryacademy 3 жыл бұрын
Just double check with the code in the repository
@abdullahyaqoob3707
@abdullahyaqoob3707 3 жыл бұрын
Thanks Zander for the clear explanation, I have do question about how to update product_total_price after I do change the quantity. if possible that you can guide me to the steps need to be implement.
@abdullahyaqoob3707
@abdullahyaqoob3707 3 жыл бұрын
I manage to create new function in the basket class which calculate product total price and update the frontend AJAX. now I have issue that always the product in the top always taking any update on the total price and the rest didn't.
@veryacademy
@veryacademy 3 жыл бұрын
It’s tricky to explain, you look like you might be going the right way about it. Later in the series we do implement it. Have a look at the code in the repository
@abdullahyaqoob2658
@abdullahyaqoob2658 3 жыл бұрын
@@veryacademy thanks a lot for prompt answer. Would you please guiding me to which part in the repository I should look. I checked out all of them and none of them have this functionality
@lifesabeach-bz5lm
@lifesabeach-bz5lm 6 ай бұрын
hey I created the sessions but when I logout with a user and I log back in with the same user I find the basket empty can you help
@AbdelmalekAitmohammed
@AbdelmalekAitmohammed Жыл бұрын
is using post form would be better for the shopping cart ?
@rizwanrehman6833
@rizwanrehman6833 3 жыл бұрын
Wonderfull course, following through it.
@siyayat
@siyayat 3 жыл бұрын
Awesome Tutorial
@veryacademy
@veryacademy 3 жыл бұрын
Glad you liked it
@satvirsingh8466
@satvirsingh8466 3 жыл бұрын
Why to do copy of self.basket as it do nothing just but modifies the original session data also. Then why we cannot use self.basket itself. I f there is need to copy the dictionary can we use deepcopy(). Will it effect anything. Please help.
@code-snippets
@code-snippets 3 жыл бұрын
Great tutorial, very good quality, thank you very much!!
@yar8519
@yar8519 Жыл бұрын
thanks a lot very useful and nice way of teaching
@muntasirmahmud4085
@muntasirmahmud4085 3 жыл бұрын
Sir, your graphQL playlist was one of the best....and there are not many resources about django-graphene...so, I request you to make more advance tutorial about django-graphene....Thank you :D
@veryacademy
@veryacademy 3 жыл бұрын
Hi m.m, thank you kindly. I have lined up a front-end implementation for graph next so that we can see how it can be implemented on the front-end with react for example. I am putting everything into this ecommerce at the minute - I probably will end up making it also into an API so we can try graph with that too. Thank you again, keep the suggestions coming
@wonganitembo5521
@wonganitembo5521 2 жыл бұрын
thank you for the detailed explanations 🙏
@gauravgupta0581
@gauravgupta0581 2 жыл бұрын
Well explained tutorial
@alexeyfilippov42
@alexeyfilippov42 3 жыл бұрын
please include subtitles. the audio translator doesn't want to work without them. even if created by the system
@yuriyarin4027
@yuriyarin4027 3 жыл бұрын
Does that tutorial about translating functions into classes already exist? 1:14:30
@veryacademy
@veryacademy 3 жыл бұрын
Hi Yuri, not just yet
@ROMAN-zu3wu
@ROMAN-zu3wu 2 жыл бұрын
Really great man
@gabcuch
@gabcuch 3 жыл бұрын
Thank you so much for this course. When I add the ProductManager with the filter is_active=True, it affects not only the home, but also the admin dashboard, so I can't edit the inactive products even when the "All" option is selected on the is_active filter of the dashboard . How can I see all the products in the admin dashboard, but show only the active ones in the home view?
@antonjalalipour4499
@antonjalalipour4499 3 жыл бұрын
great tutorial, Thanks for the upload! I have an issue, on the product summary page, When I update the quantity of a product by picking a new number from the drop down, let's say changing the number from 4 to 2 for instance and then press the 'update' button, the number on the shopping cart button perfectly changes simultaneously. Yet my issue is with the 'delete' button. When I press delete, the product perfectly gets removed and disappears from the cart, yet in order for the number on the shopping cart button to update, I have to manually refresh the page after deleting the product, in order to see the correct number on the shopping cart button. What areas of my code should I look into please?
@xin2715
@xin2715 2 жыл бұрын
Hello, your video is very good. I am a Chinese and my English is not very good. I watch your video with the help of KZbin letters, but some videos have no subtitles, which makes it difficult for me to learn. Can you add subtitles?
@saidtahmazov9197
@saidtahmazov9197 2 жыл бұрын
You're awesome, man!
@satvirsingh8466
@satvirsingh8466 3 жыл бұрын
I am trying to put the javascript code in separate js files. But the django urls are not working there. What to do please can someone tell me.
@veryacademy
@veryacademy 3 жыл бұрын
Tricky one to give advice here - move files then you need to link to the file. Put the js file in the static folder and make sure that when you call the file you include static on the temple and then call the file with static
@satvirsingh8466
@satvirsingh8466 3 жыл бұрын
@@veryacademy Did that but it is not recognizing the url. Giving 404 error. What I did: In detail.js file, ajax url: '{% url "basket:basket_add" %}'. And in html file: {% load static %} and then Not working......
@debs4143
@debs4143 2 жыл бұрын
For anyone who might have been confused at all - i was racking my brain into the early morning trying to figure out why my sessions were not updating on the database, it only had one row with the same session_key from the very beginning (where we added the dummy numbers 123321) - went to sleep, woke up, tried the server on my google chrome where i could actually F12 it and realised I was not clearing the session so that a new one could be generated when refreshed, so was staying on that same session! It is now showing but just incase anyone was confused - I am not great at picking up small details sometimes.
@debs4143
@debs4143 2 жыл бұрын
Also AMAZING tutorial so far!
@Munchen888
@Munchen888 4 ай бұрын
Please could you help me? When user select a product which he/she would be data about product from frontend is sent to backend. Session modifies but it don't appear in browser. I don't see it in devtools -> application -> cookies session_id. Installed apps and Middleware are written
@phinehasuchegbu8068
@phinehasuchegbu8068 3 ай бұрын
I don’t understand your question
@andvit77766688
@andvit77766688 3 жыл бұрын
I can't see data in request.POST, django documentation says that all non-form fields may be accessible from request.body. Is it jquery make post method as a form submission? (I use fetch instead of jquery). I also don't have access to csrf_token on my template and there's no csrf token in cookies for non-authorized users. Did you do something specific to have it?
@veryacademy
@veryacademy 3 жыл бұрын
This might help you stackoverflow.com/questions/40893537/fetch-set-cookies-and-csrf Regarding csrf - one point to note if you are serving your JS from a separate file - I showed an example in the part 3 - you can pass your csrf token to the JS file - example at the bottom of this file. Else you can grab it using JS - but that is a little more code. It you are having problems on the Django template - that is a strange one - double check the session is being created. If you are using chrome - f12 go to application and look at cookies on the left hand side - you should see the csrf token stated there. If so - you could create some JS to grab it github.com/veryacademy/YT_Django_Project_Ecommerce_Part_3_Final_v1/blob/main/templates/payment/home.html
@andvit77766688
@andvit77766688 3 жыл бұрын
@@veryacademy Thanks! I got that when you use '{{ csrf_token}}' in the template django sets csrf token in the cookies, however initially I used function provided by django documentation and there was no token in cookies, in order to get it you have to call get_token function on backend from django.middleware.csrf import get_token. Still request.POST is empty, in order to get data I have to use this code: data = json.loads(request.body.decode())
@sofianeamr7398
@sofianeamr7398 3 жыл бұрын
remark: u might need to run " sudo apt install sqlite" to view database, other wise u ll get an error
@Sickkkkiddddd
@Sickkkkiddddd 2 жыл бұрын
There is some divergence in the code displayed in the video and the code in the git repo (as at December 31 2022 - date of this comment). This is making the tutorial very hard/frustrating to follow much as I'm enjoying it. I keep running into errors I'm forced to fix without the required expertise.
@veryacademy
@veryacademy 2 жыл бұрын
Hmmm ok thank you for letting me know. 2023 I will refresh this series.
@Sickkkkiddddd
@Sickkkkiddddd 2 жыл бұрын
@@veryacademy Thanks, chief. Awesome course regardless. Mind blowing stuff!
@alexey6680
@alexey6680 Жыл бұрын
Context_processors in django looks like dependency injection.
@heidik1757
@heidik1757 3 жыл бұрын
Really good video! I was just curious how long it took you to learn everything this well?
@veryacademy
@veryacademy 3 жыл бұрын
Shorter than it took to forget - that's the real problem! 😁 1st year, just do as much as you can, 2nd year things start to stick a bit more, 3rd year explore and expand 👍 Good luck
@heidik1757
@heidik1757 3 жыл бұрын
@@veryacademy oh awesome! truly appreciate your comment! I always thumbs up to show my appreciation to you. Cheers!
@incrediblesam2236
@incrediblesam2236 3 жыл бұрын
why does mine say Basket() takes no argument?
@suzainshilakar2253
@suzainshilakar2253 2 жыл бұрын
i am getting error on def __iter__(self) where products =Products.products.filter(id__in=product_ids) the error is type object 'Product' has no attribute 'product'
@nickyfrs
@nickyfrs 2 жыл бұрын
Hi there, any luck with fixing it?
@suzainshilakar2253
@suzainshilakar2253 2 жыл бұрын
@@nickyfrs yeah i got it
@nickyfrs
@nickyfrs 2 жыл бұрын
@@suzainshilakar2253 ok. That's good. Care to share? How can I fix it? What was the reason for the error?
@ktbuffalo1
@ktbuffalo1 2 жыл бұрын
@@nickyfrs .You'll love this in, change products to objects.
@nickyfrs
@nickyfrs 2 жыл бұрын
@@ktbuffalo1 thanks. Appreciated 👍
@franciscodelafruitas9424
@franciscodelafruitas9424 2 жыл бұрын
Excellente tutorial! You mention sessions in this context as monolithic or old, what is the current method/approach?
@cridow
@cridow 3 жыл бұрын
your tutorials have been saving my ass! thanks so much
@veryacademy
@veryacademy 3 жыл бұрын
Hi Alice, I did see you other message, hopefully you worked it out! Hopefully your teacher will be happy with your/my work 🤣
@maxstarke6622
@maxstarke6622 3 жыл бұрын
I know that it is an old video but if someone could help me i would really aprecciate. When i build the ajax code (the same of the video, line by line) and i try to add to basket it doesen't work. My session keep returning me a empty dict and if i open the console there is a 500 Error: ("TypeError at /basket/add/ Object of type Decimal is not JSON serializable "). When i put a breakpoint in the view basket_add it doesn't even stop there. (i'm running on debug mode). Someone has some idea of what it could be?
@maxstarke6622
@maxstarke6622 3 жыл бұрын
I solve it! If someone has the same problem in the future the solution it's simple: Change the Product Model. You should change the price from DecimalField to FloatField and run the migrations... price = models.FloatField()
@nemanjaboo
@nemanjaboo 3 жыл бұрын
@@maxstarke6622 Dude, thank you so much!
@smokeydizzle01
@smokeydizzle01 3 жыл бұрын
@@maxstarke6622 Genius!
@massambasene4400
@massambasene4400 2 жыл бұрын
hello I am running into the same error as you are it seems. Did you solve it?
@maxstarke6622
@maxstarke6622 2 жыл бұрын
@@massambasene4400 have you tried to change the field from decimal to float?
@orhansoyer7450
@orhansoyer7450 2 жыл бұрын
Can you please activate the subtitles in the 2nd video of this series.. thank you 🙏
@veryacademy
@veryacademy 2 жыл бұрын
Will try to, sometime KZbin doesn’t provide them, normally 4+ hour videos
@igormundim
@igormundim 2 жыл бұрын
O vídeo esta sem legenda! 😰
@ramiboutas
@ramiboutas 3 жыл бұрын
does anyone get this error: "TypeError: 'int' object is not subscriptable" in the add method of Basket class? It is caused by this piece of code >. Please help! Thank you!
@ramiboutas
@ramiboutas 3 жыл бұрын
ok, I find the issue. It was a silly one. I left the init method of the class with that dummy data -> basket = self.session['skey'] = {'number': 123123} /// it has to be an empy dict -> basket = self.session['skey'] = {}
@nickyfrs
@nickyfrs 2 жыл бұрын
i am getting error on def __iter__(self) where products =Products.products.filter(id__in=product_ids) the error is type object 'Product' has no attribute 'product' any ideas as what to do to fix it? Someone already had the same issue and was asking 4 weeks ago and nobody reply. Can somebody help with this please. Thank you in advance.
@yousufali0315
@yousufali0315 Жыл бұрын
I have also same problem
@yousufali0315
@yousufali0315 Жыл бұрын
Try to use "products = Product.objects.filter(id__in=product_ids)" I think it will be work
@BelethKing
@BelethKing 3 жыл бұрын
Hey do you have any idea why after I created basked I cannot get directly to this url and error raised is by Raised by: store.views.product_detail no idea why at this point ,any clues?
@veryacademy
@veryacademy 3 жыл бұрын
HI Michael, difficult to give you too much info from your description - but it does point to an error coming from the product_detail view - have you set the url correctly - most of the time its just a typo error.
@BelethKing
@BelethKing 3 жыл бұрын
@@veryacademy hey again, thank you for your quick reply and this is what I found so I will share for later purpose of anyone. So I checked against my urls whats going on and tried to find it out. Turns out I had to change orders in urlpatterns in core/urls.py urlpatterns = [ path('admin/', admin.site.urls), path('basket/', include('basket.urls', namespace='basket')), path('', include('store.urls', namespace='store')), ] and put my basket/ above the 'home' url ,so far everything works and doesn't throw an error. That put me into confusion why having the same code gives me different result in that matter. Cheers and thank you for all the work you're doing with that awesome channel :)
@veryacademy
@veryacademy 3 жыл бұрын
@@BelethKing Thank you, good to hear it is sorted
@jhoanmartinezsilva2609
@jhoanmartinezsilva2609 3 жыл бұрын
@@BelethKing Not worked for me
@phylaxcool
@phylaxcool 3 жыл бұрын
@@BelethKing omg stucked for this for hour.. glad i found this thanks
@mr-engin3er
@mr-engin3er 3 жыл бұрын
Will you add multi vendor functionality to this project?
@veryacademy
@veryacademy 3 жыл бұрын
What would you like to see?
@mr-engin3er
@mr-engin3er 3 жыл бұрын
multi vendor functionality like sellers can register and sell their products. Amazon type ecommerce platform.
@Foxdon
@Foxdon 3 жыл бұрын
could someone please explain me basket = self.session['skey'] = { } and self.basket = basket . How does the basket dictionary value gets save into sessions basket value??
@veryacademy
@veryacademy 3 жыл бұрын
Hi Avishkar, request.session = get access to sessions I save this in a variable session to cut down on repeating it many times session["address"] = {"address_id": str(addresses[0].id)} I now call session (which is the access to the session date) and add data first I define the key address in this case as a string, then I define what I want to save, here I have an address_id and then : now I define the data I want to save (key value pair) self.basket = basket Remember I first initiate the session, then added some data. So here if you follow the code you see that I save the session data in basket. So whenever I call basket I am getting all the data in the session so that I can work with it further.
@Foxdon
@Foxdon 3 жыл бұрын
Thank you so much for responding sir. I'm still confused, when you added the value as basket = self.session['skey'] = {'number': 12311 } In python we can break it as : basket = { 'number':12311} and self.session['skey'] ={ 'number':12311 } self.basket = basket, translates to means self.basket = { 'number':12311}. How come when you add the product's info to the self.basket, it gets saved in session as session[ 'skey'] = { 'product_id' : price }. Would you please help me clear this sir? maybe I'm missing some detail.
@ilhammirzayev5696
@ilhammirzayev5696 3 жыл бұрын
​@@Foxdon Have exactly the same question. Were you able to clarify it?
@airinakter2003
@airinakter2003 3 жыл бұрын
Why I am facing this problem? Module "basket.context_processors" does not define a "basket" attribute/class
@veryacademy
@veryacademy 3 жыл бұрын
Double check your code with my code in the repository. Sometime is missing
@amaterasu7532
@amaterasu7532 3 жыл бұрын
The author passes {{product.price}} into the template and it somehow gets multiplied, when { item.price } is what we need i guess. But multiplication does not work in the __iter__ function. it works, but it doesnt change the price in the session dict. I have no clue how this works in your case, any thoughts?
@amaterasu7532
@amaterasu7532 3 жыл бұрын
I actually figured out that you have to convert item[qty] to Decimal, cause it is stored in a session as an integer. It would be nice if this mistake will be noticed by the author. Thanks a lot for your tutorial, i found it the most useful for starting django developers. I consider this information golden for everyone out there trying to build something with django.
@veryacademy
@veryacademy 3 жыл бұрын
Thanks Amaterasu 👍 I think I update this is a later tutorial
@Sasuke-px5km
@Sasuke-px5km Жыл бұрын
maybe you should recreate a video but now using nuxt 3 cause it's amazing framework
@saulrojas4984
@saulrojas4984 2 жыл бұрын
Excelent tutorial. Just one thing to observe: why did you disable subtitles for this video? I'm not a native English speaker so I'd really apeciate it because if I don't understand some words i can always read the subtitles. Thank you
@veryacademy
@veryacademy 2 жыл бұрын
Google doesn't add them to videos over a certain length.
@saulrojas4984
@saulrojas4984 2 жыл бұрын
@@veryacademyOh, I understand. I didn't know that! thanks for answer so quickly
@HmKabir1212
@HmKabir1212 Жыл бұрын
@@veryacademy For some reason my comments are not posting so I am writing here, sorry for that. Timestamp "3:58:19" as you did, first you added 1, then 2, 3, 4 “and the basket” at the top nav NAV BASKET acted accordingly, updated each time but I tried another way of testing descending, first I added 4 then made the QTY 3 and "add to basket" but basket on top nav menu not updating accordingly, it's staying 4 but it should be 3, if I select 2 from QTY and add to basket the top nav basket should be 2 but it's not happing. It stays as four and if I want to update that QTY I had to do it manually go to the basket and update it. Your project tutorial is very helpful. Your coding is the art of coding. Thanks for the tutorials. @Very Academy
@rangabharath4253
@rangabharath4253 3 жыл бұрын
Awesome
@veryacademy
@veryacademy 3 жыл бұрын
Thank you, any problems let me know.
@andyjohn907
@andyjohn907 3 жыл бұрын
I have noticed that when a product is deleted from the cart the subtotal and cart total quantity are not updated immediately...but anyway nice tutorial..
@veryacademy
@veryacademy 3 жыл бұрын
Thanks Andy, this just establishes the need for testing even further. The main thing at the minute is you understand the underpinning principle or pattern. 👍
@andyjohn907
@andyjohn907 3 жыл бұрын
@@veryacademy Thanks for the quick response , just figured out where i messed up...
@MohamedAmineTalib
@MohamedAmineTalib Жыл бұрын
very good
@joshuablue-jack
@joshuablue-jack 2 жыл бұрын
My delete button works but when I refresh all the items deleted come back. HELP!!!
@veryacademy
@veryacademy 2 жыл бұрын
Sounds like you need to make sure you have deleted the session data?
@joshuablue-jack
@joshuablue-jack 2 жыл бұрын
@@veryacademy Okay. I printed out my product id and it says None. Could that also be the reason it isn’t deleting?
@pjdaly1796
@pjdaly1796 3 жыл бұрын
Great videos, have you by any chance a video on how to create a recommender system for an app like this?
@veryacademy
@veryacademy 3 жыл бұрын
Definitely will be adding it in the advance phase. Once we get the basic functions in we will move to adv - Postgres, Docker, Elasticsearch, Recommendations and so on 👍
@pjdaly1796
@pjdaly1796 3 жыл бұрын
@@veryacademy Thats brilliant, thank you
@largoxx
@largoxx 3 жыл бұрын
@@veryacademy Hello. Realyy looking forward for this. I hope you didn't change your mind about adv stuff (docker, postgres etc.). Thank you for the videos
@veryacademy
@veryacademy 3 жыл бұрын
@@largoxx We will be back on it soon. I try and give you all updates in the community chat. We need to get this over the line so that we can move on with more advanced topics. I will be setting up a collaborative activity to help test it all shortly - then onwards with it. I am totally relying on completing this project - without it, it is really hard to teach adv topics without a good setup to start with.
@largoxx
@largoxx 3 жыл бұрын
@@veryacademy good luck with that, mate. once again, thank you for the content
@eazyscrib9466
@eazyscrib9466 3 жыл бұрын
Thank you for this project, I really enjoy it. But I'm finding it difficult to comprehend the testing part
@satvirsingh8466
@satvirsingh8466 3 жыл бұрын
Testing is just a dummy data which you give by yourself, to check that if the test data will give similar results if you enter through your site. This will help rectify bugs if you accidentally change data that you are not meant to. It will save you hell of time.
@eazyscrib9466
@eazyscrib9466 3 жыл бұрын
@@satvirsingh8466 OK, thank you so much 👏👏
@equalsfit5685
@equalsfit5685 3 жыл бұрын
bug in the add basket. you used = when it should be.... self.basket[product_id]['qty'] += qty
@veryacademy
@veryacademy 3 жыл бұрын
Thank you!
@laluchademeche
@laluchademeche 3 жыл бұрын
2:31:32 Please could you better explain this error I keep getting 'int' object is not subscriptable
Python Django - Build a user, payment and order management system
4:51:40
Using bolt.new and Supabase to build an Instagram clone
1:19:48
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 821 М.
Python Django Ecommerce Multi-Product Types Database Implementation
1:35:45
Learn Django - Build an Asynchronous Chatroom with Django and Channels
1:31:27
Dependency Injection | Prime Reacts
28:34
ThePrimeTime
Рет қаралды 363 М.
Мастер и Мандарины - Уральские Пельмени
1:34:39
Уральские Пельмени
Рет қаралды 1,2 МЛН
All Rust string types explained
22:13
Let's Get Rusty
Рет қаралды 192 М.
Embedded Rust setup explained
23:03
The Rusty Bits
Рет қаралды 96 М.
Python Logging: How to Write Logs Like a Pro!
11:02
ArjanCodes
Рет қаралды 185 М.
Новый год 2025 на ТНТ "ComedyVision!" @ComedyClubRussia
1:16:27
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН