"else" clause on "ifchanged"

32 views
Skip to first unread message

Malcolm Tredinnick

unread,
Jun 11, 2007, 4:46:23 PM6/11/07
to django-d...@googlegroups.com
I don't want to start an opening/closing battle in Trac, so I'll bring
this up here: I'm almost convinced by the use case for adding "else" to
"ifchanged" in #4534.

It's admittedly very borderline and on another day I could see myself
saying this is programming with templates. But for some reason (even if
only just because I'm fickle and unpredictable), this one seems valid.
Anybody else who isn't James or SmileyChris (since they've spoken in the
tickets) got a strong opinion either way?

Malcolm

Honza Král

unread,
Jun 11, 2007, 4:54:09 PM6/11/07
to django-d...@googlegroups.com
All the other IF* tags have else clause, I see no reason why ifchanged
should be alone without it.

I say +1 for consistency


--
Honza Král
E-Mail: Honza...@gmail.com
ICQ#: 107471613
Phone: +420 606 678585

Jacob Kaplan-Moss

unread,
Jun 11, 2007, 4:56:26 PM6/11/07
to django-d...@googlegroups.com
On 6/11/07, Malcolm Tredinnick <mal...@pointy-stick.com> wrote:

I'm -0, mostly because I still can't *quite* wrap my head around why
anyone really needs this. However I agree that #4534 has the best use
case so far. I suspect that if I saw a working patch I might lean a
bit more towards +0, but it's pretty low on my radar.

Frankly, though, I'm not gonna care much either way, so I think that
if Malcolm's convinced I can arrange to be as well.

Jacob

Marty Alchin

unread,
Jun 11, 2007, 6:27:02 PM6/11/07
to django-d...@googlegroups.com
On 6/11/07, Malcolm Tredinnick <mal...@pointy-stick.com> wrote:
> Anybody else who isn't James or SmileyChris (since they've spoken in the
> tickets) got a strong opinion either way?

I had a bit of a conversation with SmileyChris about this in IRC
recently, though that was before this use case came up. I spent about
an hour trying to come up with realistic use cases and was unable to,
but I figured there was a reasonable use case out there somewhere.

With a decent use case and the consistency issue Honza mentioned, I'd
say I'm +0. It's certainly an edge case, but those are really the only
cases where this would come into play.

-Gul

SmileyChris

unread,
Jun 11, 2007, 6:42:55 PM6/11/07
to Django developers
On Jun 12, 8:56 am, "Jacob Kaplan-Moss" <jacob.kaplanm...@gmail.com>
wrote:

> I suspect that if I saw a working patch I might lean a
> bit more towards +0, but it's pretty low on my radar.

Ok, I attached a patch. The funny thing is that that use-case sounded
good but it won't work due to how {% for %} works - it discards
additions to the context between loops.

Niels

unread,
Jun 12, 2007, 5:27:19 AM6/12/07
to Django developers
Would this make a valid use case?

{% for match in matches %}
<div class="
{% ifchanged match.ballot_id %}
add-padding
{% else %}
keep-together
{% endifchanged %}
">{{ match }}</div>
{% endfor %}

On Jun 12, 12:42 am, SmileyChris <smileych...@gmail.com> wrote:
> On Jun 12, 8:56 am, "Jacob Kaplan-Moss" <jacob.kaplanm...@gmail.com>
> wrote:
>
> > I suspect that if I saw a working patch I might lean a
> > bit more towards +0, but it's pretty low on my radar.
>

btw i'm +1 in case you'd wonder

Niels Poppe

Reply all
Reply to author
Forward
0 new messages