I'm wishing for a "less than" and "greater than" in templates.
The mailing list has this on the matter:
On 31-Aug-06
>> Is it possible to make "less than" and "greater than" comparisons in
>> templates?
>> I was trying to do something similar to this, but without success:
>> {% if list|length > max_list_length %}
>> Exceeded by {{ list|length - max_list_length }} items
>> {% endif %}
>
> write your own tag - someone has done it, you can see it in this file:
>
> http://nrcfosshelpline.in/code/browser/trunk/web/templatetags/
> base_utils.py
>
> class CompareNode near the end
But that link above no longer works.
Does anyone have some code for this?
I looked in Django Snippets and didn't find such a snippet.
Mike
--
Michael Lake
>> write your own tag - someone has done it, you can see it in this
>> file:
>>
>> http://nrcfosshelpline.in/code/browser/trunk/web/templatetags/
>> base_utils.py
>>
>> class CompareNode near the end
>
> But that link above no longer works.
works now - thanks for the heads up on this
--
regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
> On 22-Mar-07, at 9:25 AM, Michael Lake wrote:
>>>write your own tag - someone has done it, you can see it in this
>>>file:
>>>
>>>http://nrcfosshelpline.in/code/browser/trunk/web/templatetags/
>>>base_utils.py
>>>
>>>class CompareNode near the end
>>
>>But that link above no longer works.
> works now - thanks for the heads up on this
Thanks for that Kenneth.
The code there looks like just what I need.
Mike
--
Michael Lake
http://www.djangosnippets.org/snippets/12/
And it can support any python expression. So it's more general I think.
--
I like python!
UliPad <<The Python Editor>>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou
And it's short and understandable. I like it too.
Thanks
Mike
--
Michael Lake