Re: Is middleware appropriate for this?

2008-04-11 Thread Panos Laganakos
Thanks for the link Chris, but this is not what I'm trying to do. I'm not worried about the way the price look, but the price currency itself. Since the user is allowed to select that per session. If there's a way for a filter to access the session variables I would be OK, since instead of

Re: Is middleware appropriate for this?

2008-04-11 Thread Chris Moffitt
Take a look at what we use in Satchmo. Maybe this will help - http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/shop/templatetags/satchmo_currency.py -Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Is middleware appropriate for this?

2008-04-11 Thread Panos Laganakos
Dan, I don't think context_processors will do any good, since I'd have to load each product and its price on the context. imagine a model: Product(models.Model): price = models.FloatField(...) and a Currency(models.Model): code = models.CharField(maxlength=3) # USD, YEN, etc

Re: Is middleware appropriate for this?

2008-04-11 Thread Dan Ellis
On Apr 11, 11:37 am, Panos Laganakos <[EMAIL PROTECTED]> wrote: > I'm wondering if working on a > middleware, `process_view` or something would be the right place to > make the conversion. Not a middleware, but a context processor.

Is middleware appropriate for this?

2008-04-11 Thread Panos Laganakos
I've written a currency filter that takes the 3 letter code of a currency and gives you the price. {{ product.price|currency:"EUR" }} There's a context variable called CURRENCY which specifies the current session's currency. I'm not able to pass that variable in the filter itself instead of a