Re: Not calling things twice in templates

2013-06-02 Thread Shai Berger
On Monday 03 June 2013, Russell Keith-Magee wrote: > Alternatively, add new sub tags to {% for %}: > > {% for bee in my_bonnet.bees %} > {% pre %} > > {% body %} > {{ bee }} > {% post %} > > {% empty %} > No bees in your bonnet. > {% endfor %} > > but that's starting to get verbose, and lea

Re: Not calling things twice in templates

2013-06-02 Thread Andre Terra
Well, Russ, you asked for suggestions, so here's a couple half-hearted attempts. Perhaps we could allow for if clauses in the with block or vice-versa? It could be argued that it would reduce readability and/or induce confusion with conditional expressions[0], and I would have to agree. {% with m

Re: Not calling things twice in templates

2013-06-02 Thread Russell Keith-Magee
On Mon, Jun 3, 2013 at 5:36 AM, Daniele Procida wrote: > The for ... empty pattern in templates is common and useful: < > https://docs.djangoproject.com/en/dev/ref/templates/builtins/#for-empty> > > But this is another common pattern: > > {% if my_bonnet.bees %} > > {% for bee in my_

Re: Not calling things twice in templates

2013-06-02 Thread Jeremy Dunck
I've had this issue and have used {% with %} or moved the my.bonnet() call into the view/context.I agree, not ideal, but I was never moved to make it better in general. If you're suggesting a general caching layer in the template such that a given expression is only called once in the course o

Not calling things twice in templates

2013-06-02 Thread Daniele Procida
The for ... empty pattern in templates is common and useful: But this is another common pattern: {% if my_bonnet.bees %} {% for bee in my_bonnet.bees %} {{ bee }} ... In other words, w

Re: [GSoC] Composite fields once again

2013-06-02 Thread Luke Sneeringer
On Jun 2, 2013, at 8:22 AM, Michal Petrucha wrote: > GenericForeignKey and nontrivial field types > > > As I've indicated in my proposal, just casting any value to a string > and then performing a reversible transformation on such strings may > work

[GSoC] Composite fields once again

2013-06-02 Thread Michal Petrucha
Hello everyone, I'm happy to announce that throughout the summer I'll be officially working on composite fields under the supervision of Andrew Godwin as part of this year's GSoC. I'll use this thread to post all my weekly status updates regarding this project. This email gives a brief overview o