Hey All,

I'm trying to create a 'shopping' website, and one of the design
elements that is necessary is that the "Purchase this item" link
changes to a "Remove this item from your cart" link when the item has
been added to the user's Shopping Cart.

When an object is added to the shopping cart, a ShoppingCartItem
object is created (this is necessary to allow for things like
quantities, item discounts, shipping calculation etc...), and I need
to tell whether a ShoppingCartItem the exists for a particular Item
(fk'd to the user's ShoppingCart).

Everything works great apart from this bit. I know that I can make a
template tag that has access to the request object (added by the
Context Processors), but am a bit stuck as to how to do this in a
filter. Ideally I would like to do something like:

{% if item|in_cart %}foo{% else %}bar{% endif %}

So, all I really need to know is how I would get access to the request
object in a filter. I haven't tried it, but don't think

{% if item|in_cart:request.session.cart %}

Would work. Any help in getting access to the request (or session)
data in a filter, or a better way if anyone can think of it, would be
much appreciated.

Kind Regards,
Oliver


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to