Re: compare integers in template (newbie question)

2006-08-16 Thread Don Arbow
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

Re: compare integers in template (newbie question)

2006-08-16 Thread Don Arbow
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

Re: compare integers in template (newbie question)

2006-08-16 Thread Adam Endicott
[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

Re: compare integers in template (newbie question)

2006-08-16 Thread [EMAIL PROTECTED]
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

Re: compare integers in template (newbie question)

2006-08-16 Thread [EMAIL PROTECTED]
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

Re: compare integers in template (newbie question)

2006-08-16 Thread [EMAIL PROTECTED]
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 --~--

Re: compare integers in template (newbie question)

2006-08-16 Thread Waylan Limberg
> > 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):

Re: compare integers in template (newbie question)

2006-08-15 Thread Alan Green
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

Re: compare integers in template (newbie question)

2006-08-15 Thread Jonathan Buchanan
> 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

compare integers in template (newbie question)

2006-08-15 Thread [EMAIL PROTECTED]
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