On Saturday 28 January 2006 00:33, Russell Keith-Magee wrote:

> - Secondly, the template language doesn't lend itself to making the
> len(Model.objects) call. 

{{ objects|length }} works fine.

If you wanted it in an 'if' tag (ie. if length = some value), then you 
can't do the above, but you can't do it now either.  What you can do 
now is this:

{% if objects %}
  [ ... print out objects... ]
{% else %}
  Sorry, no objects today.
{% endif %}

With my proposal in the other e-mail, this would work exactly as before 
- bool(objects) would fetch the data, and so you would do just the one 
query as before.

Luke


-- 
"I married Miss Right, I just didn't know her first name was 'Always'"

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

Attachment: pgpMRyptZuP74.pgp
Description: PGP signature

Reply via email to