Designing and Implementing a Shopping Cart API - Lesson 5 - Missing part?

Hello friends,

I reached this part of The Ultimate Django Series: Part 2 and could not find the way to solve the excercise by myself, when looking for Mosh’s solution I can’t find how the “GET” for carts was implemented.
Am I missing something?
Where can I find the code?
Thank you for your time!
Regards
Ariel

1 Like

Hello again,
I found my error. It was just a misunderstanding of the proposed excercise.
I was trying to get my cart using a URL like …/carts?=‘cart-uuid’ and that invokes get from CartViewSet which was intendedly NOT implemented.
After careful revision of URLS on the video, using the URL as requested by Mosh could make it work …/carts/‘cart-uuid’
Hope this helps anyone there in the future if stumbled like me.
Cheers!
Ariel

hello, I have this problem too, and a still not figure out how can i resolve it, i sent the same request like Mosh did , …/carts/‘cart-uuid , but i still have the same issue “Page not found (404)”,means the GET method is not implemented !!!
any help plz…!!

Hello @Zouhair
I cannot figure out whats happening there without a little help from your side.
1 - could you please attach a screen capture?
2 - could you please share the code you implemented in your models and serializers files?
Thanks for yout time.
Regards
Ariel

Hello @ariel.robaldo

It’s Ok, i fixed it, thank you so much for your reply.
I wish you the best learning.
Best regards

Zouhair

1 Like

I also have the same problem, I can’t get the cart instance page.
Although I write the right url pattern, I’ve searched alot but I couldn’t find the solution

Hello @isra I cannot figure out whats happening there without a little help from your side.
1 - could you please attach a screen capture?
2 - could you please share the code you implemented in your models and serializers files?
3 - perhaps @Zouhair could also share his/her solution
Thanks for yout time.
Regards
Ariel

Edit I’ve solved my bug, I didn’t add (RetrieveModelMixin) to the cart view set :expressionless: so make sure you add this model to the cart view set , see 8:30 of the lesson 5 getting card

Thank you so much @ariel.robaldo I appreciate your reply.

3 Likes

@isra it was the same case for me , i forgot add the RetrieveModelMixin to teh cart view :man_facepalming: …best learning.

1 Like

I too made same mistake, but reading comments here made me realize my mistake, thanks to all.

The way this episode 5 is rolling out is very confusing.
Mosh tells you to do the exercise first but then he gives the solution in a way that you cannot follow along exactly as he is showing it. Eventually the solution comes up but later in the video.

What is confusing is not that he is not rolling out the solution step by step for us to follow along, it is that he is not saying it to us. Usually after the teacher asks for student to try to do an exercise on their own, when he gives the solution it is a follow along solution, not one where you follow the solution and find out it is still not working. The way it is delivered is not structured properly.

Anyway, the fix is given at 8:30 in that same video. The thing is we are supposed to know this and so we are supposed to find it out when the 404 error pops out. So in a way it forces you to build on previous knowledge and use it. But again, if a solution is offered, the teacher should tell us that maybe this may happen to some of us and that is why, so we can just follow along.