I may be the only one still interested in this, but the patch got
incorporated yesterday (http://code.djangoproject.com/changeset/6981),
so Malcolm, your original idea will now work.
--Ned.
Ned Batchelder wrote:
> I tried out this change, and it works well. I've created a ticket
> (http://cod
I tried out this change, and it works well. I've created a ticket
(http://code.djangoproject.com/ticket/6295) with a patch.
--Ned.
http://nedbatchelder.com
Ned Batchelder wrote:
> Malcolm, thanks for continuing this (I was away for a few days). I
> was thinking about the forloop internals as
Malcolm, thanks for continuing this (I was away for a few days). I was
thinking about the forloop internals as well, and it seems to me that
there's no reason the forloop dictionary needs to be completely new each
time around. Why not change forloop to create a new dictionary before
the first
Hey Ned,
On Sat, 2007-12-29 at 08:27 +1100, Malcolm Tredinnick wrote:
[...]
> def render(self, context):
>if context[self.varname] == id(context['forloop']):
> return self.nodelist_false.render(context)
>context[self.varname] = id(context['forloop'])
>
On Fri, 2007-12-28 at 16:01 -0500, Ned Batchelder wrote:
> I appreciate the advice, but forloop.first won't work for what I'm
> trying to do. If the first thing chosen is in the second iteration of
> the for loop, then forloop.first is never true. I don't want to know
> if I'm on the first iter
I appreciate the advice, but forloop.first won't work for what I'm
trying to do. If the first thing chosen is in the second iteration of
the for loop, then forloop.first is never true. I don't want to know if
I'm on the first iteration of the loop. I want to know if it's the
first time in th
On Fri, 2007-12-28 at 15:36 -0500, Ned Batchelder wrote:
> Just a matter of taste. I suppose filtering in the view would be the
> simplest way to achieve what I'm looking for.
>
> For my own edification: is there a way to write an iffirst tag? I
> often wish for it.
In the tag code, test to s
Just after I sent the last reply, I went to change to filtering in the
view. Then I realized why I didn't want to.
This loop is actually nested inside another (let's say it's an outer
loop over blog posts, then an inner loop over tags for each post). To
filter the tags, I have to loop over th
Just a matter of taste. I suppose filtering in the view would be the
simplest way to achieve what I'm looking for.
For my own edification: is there a way to write an iffirst tag? I often
wish for it.
--Ned.
Todd O'Bryan wrote:
> On Dec 28, 2007 2:46 PM, Ned Batchelder <[EMAIL PROTECTED]> wro
On Dec 28, 2007 2:46 PM, Ned Batchelder <[EMAIL PROTECTED]> wrote:
>
> I'm making a list of objects, and only including some of them in the output:
>
> {% for thing in mylist %}
>{% if thing.test %}
> {{thing}}
>{% endif %}
> {% endfor %}
>
Is there a compelling
> I'm making a list of objects, and only including some of them in the output:
>
> {% for thing in mylist %}
>{% if thing.test %}
> {{thing}}
>{% endif %}
> {% endfor %}
>
> Now if I want to comma-separate the list, how do I do it? The natural
> thing to my mind
I'm making a list of objects, and only including some of them in the output:
{% for thing in mylist %}
{% if thing.test %}
{{thing}}
{% endif %}
{% endfor %}
Now if I want to comma-separate the list, how do I do it? The natural
thing to my mind is an "iffirst" t
12 matches
Mail list logo