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 a declare or define tag.
>
> The idea I want to be able to do is:
>
> {% declare nopastshows=0 %}
> {% for show in object_list %}
>         {% if show.is_past_show %}
>           <h4>{{ show.show_date.month }}/{{ show.show_date.day }} {{
> show.show_title}} @ <a href="{{ show.location_url }}" target="new">{{
> show.location_name }}</a></h4>
>         {% else %}
>             {% nopastshows=1 %}
>         {% endif %}
>       {% endfor %}
>
> {% if nopastshows %}
>     <h4>No past show information available</h4>
> {% endif %}
>
>
> I saw the topic on writing a custom tag for the food selection, but
> that seems like a lot of work for such a simple task.  Does anyone have
> any suggestions?  Thanks.
>
I'v written a Custom Tag named "expr", you can try it.

http://code.djangoproject.com/wiki/ExprTag


-- 
I like python!
My Blog: http://www.donews.net/limodou
My Django Site: http://www.djangocn.org
NewEdit Maillist: http://groups.google.com/group/NewEdit

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to