Oops, missed an 'endifequal' at the end of the comparison:
{% for x in make_list object.get_rating_stars %}
{% ifequal x '*' %}
{% else %}
{% endifequal %}
{% endfor %}
Don
--~--~-~--~~~---~--~~
You
On Aug 16, 2006, at 7:12 AM, [EMAIL PROTECTED] wrote:
>
> Waylan,
>
> This is a really nifty solution, but, again, it puts presentation
> logic
> into the views.py file, which is supposed to contain business logic.
> I'd rather not do that...
But nothing is ever so rigid as to require you do i
[EMAIL PROTECTED] wrote:
> I'd really love to be able to do something like this:
> {% if videoObject.rating > 0 %}*{% endif %}
> {% if videoObject.rating > 1 %}*{% endif %}
> {% if videoObject.rating > 2 %}*{% endif %}
If this type of code is your goal, you could do something like:
{% ifequal vi
Thanks, Alan!
Widthratio is exactly what I'm looking for to solve this problem!
I still wish for a custom "if" tag to solve non-charting problems in
templates, and I guess I'll just have to write it and post it to the
wiki. But for now, widthratio does exactly what I need, when I need
it.
Mae
I can do that, but it would couple presentation with my Video model,
and I'd rather not. After all, I suspect that denying me the proper
"if" tag was Django's political statement of "thou shalt not couple
presentation with business logic, and we shall enforce it". It'd be a
shame to couple tiers
Waylan,
This is a really nifty solution, but, again, it puts presentation logic
into the views.py file, which is supposed to contain business logic.
I'd rather not do that...
A custom template tag is possibly my solution, and yes, I'm surprised
that no one else had done it yet, too.
Mae
--~--
>
> How about adding a method to your Video model?
>
> Video model:
> def get_rating_stars(self):
> return "***" # Implementation left as an exercise for the reader ;-)
>
This isn't much of an exercise, although it may not be immediately
obvious to the noobi.
def get_rating_stars(self):
On 8/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Folks,
>
> I'd really love to be able to do something like this:
> {% if videoObject.rating > 0 %}*{% endif %}
> {% if videoObject.rating > 1 %}*{% endif %}
> {% if videoObject.rating > 2 %}*{% endif %}
>
> To display an appropriate numb
> Folks,
>
> I'd really love to be able to do something like this:
> {% if videoObject.rating > 0 %}*{% endif %}
> {% if videoObject.rating > 1 %}*{% endif %}
> {% if videoObject.rating > 2 %}*{% endif %}
>
> To display an appropriate number of stars for a video clip in a
> template.
>
> Right
Folks,
I'd really love to be able to do something like this:
{% if videoObject.rating > 0 %}*{% endif %}
{% if videoObject.rating > 1 %}*{% endif %}
{% if videoObject.rating > 2 %}*{% endif %}
To display an appropriate number of stars for a video clip in a
template.
Right now, I'm resorting to
10 matches
Mail list logo