Re: Declare a variable in a template

2006-08-04 Thread JHeasly
Don Arbow wrote: > > list_1 = Shows.objects.filter(upcoming=True) > list_2 = Shows.objects.filter(past=True) > > return render_to_response('template.html' > {'upcoming_shows':list_1, 'past_shows':list_2}) > > Don Don, Thanks for the clean, clear example! It helped me see a way out in a var

Re: Declare a variable in a template

2006-08-03 Thread limodou
On 8/4/06, skullvulture <[EMAIL PROTECTED]> wrote: > > Is there anyway to declare variables within a template? I'm coming > from a Zope background where with dtml you have the dtml-let tag and > with ZPT you have tal:define. Django's templating seems so much cooler > than Zope's, but I'm missing

Re: Declare a variable in a template

2006-08-03 Thread James Bennett
On 8/3/06, skullvulture <[EMAIL PROTECTED]> wrote: > I have another loop above that displays upcoming shows. Is it possible > to have two object lists, one of upcoming and one of past shows be > passed to the template? A view can pass any number of variables it wants to, with any legal Python va

Re: Declare a variable in a template

2006-08-03 Thread Don Arbow
On Aug 3, 2006, at 2:45 PM, skullvulture wrote: > I have another loop above that displays upcoming shows. Is it > possible > to have two object lists, one of upcoming and one of past shows be > passed to the template? Yes, you can pass any sort of data that you want to your template. So, if

Re: Declare a variable in a template

2006-08-03 Thread skullvulture
Don, I have another loop above that displays upcoming shows. Is it possible to have two object lists, one of upcoming and one of past shows be passed to the template? Thanks Adrian, I understand your philosophy of separating presentation and logic, but even in your there you say that the tem

Re: Declare a variable in a template

2006-08-03 Thread Don Arbow
On Aug 3, 2006, at 1:05 PM, skullvulture wrote: > > Is there anyway to declare variables within a template? I'm coming > from a Zope background where with dtml you have the dtml-let tag and > with ZPT you have tal:define. Django's templating seems so much > cooler > than Zope's, but I'm missin

Re: Declare a variable in a template

2006-08-03 Thread James Bennett
On 8/3/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > * If you're not using any of the objects with is_past_show == False, > then change your view so that object_list is only the objects with > is_past_show==True. Then you can do this: Assuming the use of the object_list generic view, this is p

Re: Declare a variable in a template

2006-08-03 Thread Adrian Holovaty
On 8/3/06, skullvulture <[EMAIL PROTECTED]> wrote: > Is there anyway to declare variables within a template? I'm coming > from a Zope background where with dtml you have the dtml-let tag and > with ZPT you have tal:define. Django's templating seems so much cooler > than Zope's, but I'm missing a

Re: Declare a variable in a template

2006-08-03 Thread James Bennett
On 8/3/06, skullvulture <[EMAIL PROTECTED]> wrote: > Is there anyway to declare variables within a template? I'm coming > from a Zope background where with dtml you have the dtml-let tag and > with ZPT you have tal:define. Django's templating seems so much cooler > than Zope's, but I'm missing a

Declare a variable in a template

2006-08-03 Thread skullvulture
Is there anyway to declare variables within a template? I'm coming from a Zope background where with dtml you have the dtml-let tag and with ZPT you have tal:define. Django's templating seems so much cooler than Zope's, but I'm missing a declare or define tag. The idea I want to be able to do i

Re: Declare a variable in a template

2005-12-05 Thread Waylan Limberg
On 12/3/05, Jiri Barton <[EMAIL PROTECTED]> wrote: > > Wow, dorodok, that is elegant, indeed. I have already implemented by > the inclusion_tag as the guys suggested, but I'm going to do it the CSS > way. > Just remember that every time you want to add another tab, then you'll have to edit the CSS

Re: Declare a variable in a template

2005-12-02 Thread Jiri Barton
Wow, dorodok, that is elegant, indeed. I have already implemented by the inclusion_tag as the guys suggested, but I'm going to do it the CSS way. Robert: autocorrected it to register.inclusion_tag in my code already :-) thanks Jiri

Re: Declare a variable in a template

2005-12-02 Thread dorodok
Hi Jiri! if you are only about highlighting of the active item of your UI menu in pure CSS way, I suggest you to look at solution of www.djangoproject.com site, the source of templates is: base template: http://code.djangoproject.com/browser/djangoproject.com/django_website/templates/base.html =

Re: Declare a variable in a template

2005-12-02 Thread Robert Wittams
> @inclusion_tag("myapp/menu") That should be @register.inclusion_tag("myapp/menu")

Re: Declare a variable in a template

2005-12-02 Thread Jiri Barton
I like it! Thanks

Re: Declare a variable in a template

2005-12-02 Thread Adrian Holovaty
On 12/2/05, Jiri Barton <[EMAIL PROTECTED]> wrote: > Now, I'd like to write the menu only once and then use it the following > way: > > {% declare menuselection tomatoes %} > {% include "menu" %} > > The menu would have been defined as follows: > > > endifequal %}>mushrooms > endifequal

Re: Declare a variable in a template

2005-12-02 Thread Robert Wittams
Jiri Barton wrote: > Hello there, > > I have the following problem. Here's my template fragment; it defines a > menu: > > > mushrooms > cheese > tomatoes > onion > > > Now, I'd like to be able to highlight one item in some templates, and > another item in other templates. Only

Declare a variable in a template

2005-12-02 Thread Jiri Barton
Hello there, I have the following problem. Here's my template fragment; it defines a menu: mushrooms cheese tomatoes onion Now, I'd like to be able to highlight one item in some templates, and another item in other templates. Only the templates know what should be highlighted.