{{ something or something_else }}

2008-04-25 Thread Wolfram Kriesing
I guess it might had been discussed, just didnt find anything. This extended syntax would really make some writing shorter user has {{ num_files or "no" }} files now, you have to write user has {% if num_files %} {{ num_files }} {% else %} no {% endif %} files Are there an

Re: {{ something or something_else }}

2008-04-25 Thread Patryk Zawadzki
On Fri, Apr 25, 2008 at 4:15 PM, Wolfram Kriesing <[EMAIL PROTECTED]> wrote: > > I guess it might had been discussed, just didnt find anything. > This extended syntax would really make some writing shorter > >user has {{ num_files or "no" }} files user has {{ num_files|default:"no"

Re: {{ something or something_else }}

2008-04-25 Thread Honza Král
there is a template filter called default, that does exactly this. http://www.djangoproject.com/documentation/templates/#default On Fri, Apr 25, 2008 at 4:15 PM, Wolfram Kriesing <[EMAIL PROTECTED]> wrote: > > I guess it might had been discussed, just didnt find anything. > This extended syntax

Re: {{ something or something_else }}

2008-04-25 Thread Wolfram Kriesing
thank you for all the quick replies. Mmmmh, its good to see that it is there, though I think {{ num_files or "no" }} looks better and is closer to what I would expect ... but thats just an aesthetical thing, I guess. thanks a lot Wolfram On Fri, Apr 25, 2008 at 4:18 PM, Honza Král <[EM

Re: {{ something or something_else }}

2008-04-25 Thread mrts
Although this is really off-topic in this list, there's also http://www.djangoproject.com/documentation/templates/#firstof {% firstof foo bar baz %} that has the added benefit of outputting nothing if all of foo bar baz evaluate to False. On Apr 25, 6:35 pm, "Wolfram Kriesing" <[EMAIL PROTECTED

Re: {{ something or something_else }}

2008-04-25 Thread J. Cliff Dyer
On Fri, 2008-04-25 at 17:35 +0200, Wolfram Kriesing wrote: > thank you for all the quick replies. > Mmmmh, its good to see that it is there, though I think > {{ num_files or "no" }} > looks better and is closer to what I would expect ... > but thats just an aesthetical thing, I guess. >

Re: {{ something or something_else }}

2008-04-25 Thread Leo Soto M.
On Fri, Apr 25, 2008 at 10:15 AM, Wolfram Kriesing <[EMAIL PROTECTED]> wrote: > > I guess it might had been discussed, just didnt find anything. > This extended syntax would really make some writing shorter > >user has {{ num_files or "no" }} files > > now, you have to write > >

Re: {{ something or something_else }}

2008-04-25 Thread Wolfram Kriesing
this {% firstof %} is even better, more explicit! and it looks much nicer with filters {% firstof x|escape y|escape %} better than {{ x|escape|default:y|escape }} great, thanks for mentioning it. Sometimes there is more than one place to park your bike :-) Wolfram On Fri, Apr 25, 2008 at 5:55