Friday, June 4, 2021

Re: In immediate help of a long time pending request, kindly help.

Hello

I tried this but I'm still seeing the list of cart items. Can you tell me where I am going wrong?

Regards,
Aritra

On Tue, 1 Jun 2021 at 21:23, Joel Tanko <7thogofe@gmail.com> wrote:
If you want to show the items relative to the currently logged in user, try adding this option => limit_choices_to={'user' : 'user'}, to your items field in models.py



On Tuesday, 1 June 2021, Aritra Ray <aritra805@gmail.com> wrote:
Right, thank you so much.

Regards.

On Tue, 1 Jun, 2021, 8:27 pm oba stephen, <obastepheno@gmail.com> wrote:
You should return this if you want to redirect to cart; 

return redirect(reverse("store:cart-page", kwargs={"id": <the ID of the cart>}))

Best regards

Stephen Oba

On Tue, Jun 1, 2021, 3:27 PM Aritra Ray <aritra805@gmail.com> wrote:
Sure, here's the file.

2021-06-01 (6).png

Regards, 
Aritra.

On Tue, 1 Jun 2021 at 19:45, oba stephen <obastepheno@gmail.com> wrote:
Can I see your urls.py?

Best regards

Stephen Oba

On Tue, Jun 1, 2021, 3:05 PM Aritra Ray <aritra805@gmail.com> wrote:
Oh, okay. I was unaware of that. Although, my cart page is getting redirected back to home page. Can you spot any mistake in the provided screenshots? 
Also, can you please guide on how to redirect a function to the previously visited page? Like add-to-cart should redirect to either products page or cart page itself depending on which page the user called it from.

On Tue, 1 Jun, 2021, 6:37 pm oba stephen, <obastepheno@gmail.com> wrote:
Hi,

I don't think you have an error here. Although I haven't looked at the code, but from your django admin page I can see that none of those items are selected. 

If you run a query from your terminal, you would notice that the items would return as empty. 

When you create a many to many relationship in django, all objects on that related model would display this way. 

What is the difference between different carts?  The difference is, the items would be selected or highlighted in a cart they belong to. 

Regards 

Best regards

Stephen Oba

On Tue, Jun 1, 2021, 1:52 PM Aritra Ray <aritra805@gmail.com> wrote:

Hello, 
This is Aritra reposting the same error. I have a problem regarding an E-commerce Django website where the cart model on the admin page is showing the items added to cart by one user to all other users as well. 
I have a Profile model and a Cart model attached below. The views.py has been attached too. Kindly comment back if anything else is needed. 
Thanks in advance.


Regards,
Aritra

Error:

2021-06-01 (4).png

Views.py

2021-06-01 (1).png2021-06-01 (5).png

Models.py 

2021-06-01 (2).png2021-06-01 (3).png

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFecadtNZeLbatpdnuC_RUDdjLjbrvZTO%2BMVD7hPuHNkN%2Bv%2BBA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAJsLnpYBVfacxd3NJ7sqnC6dD2b6nBQw%3DFqfQe9Od1%2BpwTHww%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFecadvZ11v-bvZzCXUVUTpr0WBa6eVmF7M6qpoVRFNF5dS%2Bcg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAJsLnqwLQNwKExW23UW%3DgiF_co-rZ1adHcSmx6ZUSg4rDp61w%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFecaduG3p6QS%2BxdGv%2B6zi4jH_x%2BQPm%3D0TjoKjb2K8-pHc6%3DEw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAJsLnoFZZegG9bmvMLCmxhp%2B%3D6%3DnoaajxJ1m%2Ba8LXAP%2Bhk%2B9Q%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFecadtUShE1Hn_jVasfJ3sU24ctaT4YqVBHRw4T_fWn1nW08Q%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJ4Kmg5k7HuKdEx0jO%3D3PN%3DWd36eBLeAXmJ64Y9hTBa4q%2Bj%3D7w%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFecadu-wWP33O_2TL4sBHRfvAa8YBM%2B1JpcvmGuw4z1AWckvw%40mail.gmail.com.

No comments:

Post a Comment