Re: Do I have to send shopping cart data to every template in my app?

2007-08-06 Thread oggie rob
No, you don't need to use the same template. You are just filling in some data on every request using the context processor. Its like this: 1) Write a context processor that adds shopping cart info to every context. Now it can be accessed via {{ cart.items }} or however you set it up 2) Write

Re: Do I have to send shopping cart data to every template in my app?

2007-08-06 Thread Greg
Oggie, Thanks for the reply. So you're saying that it would be better to send my shopping cart data to every template through my all my view's? If that's the case then I assume there is no way to send request.session information using a custom template? Thanks On Aug 3, 4:36 pm, oggie rob

Re: Do I have to send shopping cart data to every template in my app?

2007-08-03 Thread oggie rob
If you really need to use a tag, look at http://www.djangoproject.com/documentation/templates_python/#passing-template-variables-to-the-tag But I think you probably would find it easier to add an extra context processor & avoid the tag altogether. -rob On Aug 3, 6:01 am, Greg <[EMAIL

Re: Do I have to send shopping cart data to every template in my app?

2007-08-03 Thread Greg
Thanks for your help...I'm now able to create a custom tag. However, I now seem to have a another problem with custom tags. How do I send session information to each template. I can't use request.session['cart'] in my custom tag function because it doesn't have a request parameter. I always

Re: Do I have to send shopping cart data to every template in my app?

2007-08-02 Thread oggie rob
On Aug 1, 11:22 pm, oggie rob <[EMAIL PROTECTED]> wrote: > This is what middleware is made > for.http://www.djangoproject.com/documentation/middleware/ > > -rob Sorry, I have recently been working with shopping carts and had redirection on my brain. Fabien's suggestion is probably what you are

Re: Do I have to send shopping cart data to every template in my app?

2007-08-02 Thread oggie rob
This is what middleware is made for. http://www.djangoproject.com/documentation/middleware/ -rob On Aug 1, 9:51 pm, Greg <[EMAIL PROTECTED]> wrote: > I've created a shopping cart. I want to put something on the top of > every page that let's people know how many items they have in their >

Re: Do I have to send shopping cart data to every template in my app?

2007-08-02 Thread Fabien Schwob
On 8/2/07, Greg <[EMAIL PROTECTED]> wrote: > > I've created a shopping cart. I want to put something on the top of > every page that let's people know how many items they have in their > cart. I have a lot of views that don't send any dictionary key's that > contain shopping cart info. If I

Re: Do I have to send shopping cart data to every template in my app?

2007-08-02 Thread Lucky B
You can create a custom tag, I've never done it myself, but it's in the docs: http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags I am sure you can get more help if you need it, but this should get you started. On Aug 2, 12:51 am, Greg <[EMAIL PROTECTED]>

Do I have to send shopping cart data to every template in my app?

2007-08-01 Thread Greg
I've created a shopping cart. I want to put something on the top of every page that let's people know how many items they have in their cart. I have a lot of views that don't send any dictionary key's that contain shopping cart info. If I want to do this...do I now have to edit every view