Hey,
I've been using Django for a project, and one thing I have sorely
missed is having an ifless and ifgreater template tag. Other internal
projects have had similar problems, and made at best hacks to work
around this missing feature. I understand however that there is some
hesitance to add more tags to the templating system though in an effort
to separate display and logic.
I would like to write a patch for django that implements ifless and
ifgreater, to be used for presentation purposes. For instance, I
display a table of averages, and would like to highlight rows where the
average is below 25%. Now, I could feasibly add an extra column of data
to what cursor.fetchall() returns be that specifies whether or not that
row should be highlighted, but it seems awfully hackish to me, and a
violation of display and logic in the other direction.
What I propose is something like:
{% ifgreater variable threshold %}
scream!
{% endifgreater %}
{% ifless variable threshold %}
shout!
{% endifless %}
I can add ifgreaterequal and iflessequal if it seems appropriate, but I
don't personally have a use for it.
// Thomas Stromberg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---