Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#9785 closed (wontfix)

Turn the unordered_list template filter into a block tag.

Reported by: equanimity Owned by: nobody
Component: Template system Version: dev
Severity: Keywords: unordered_list block
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

There's a problem with this tag as a filter in that one has no control over how each element in the nested list is rendered, except by changing it's __unicode__ method, which isn't overly practical. For example, say we were trying to output a list of e-mail threads:

{% unordered_list email_list as email %}
<div class="email">
    {{ email.subject }}, {{ email.sent_date }}<br/>
    {{ email.sender }}, {{ email.size }}
</div>
{% endunordered_list %}

In effect, the content of the block replaces the call to __unicode__.

I imagine the name might need to be changed to avoid confusion.
Once there's consensus on whether it'd a good idea and the semantics I'm happy to be the one to write the patch. (My current workaround works so I haven't tried to do things properly yet, particularly as things may change.)

Change History (2)

comment:1 by Malcolm Tredinnick, 15 years ago

Resolution: wontfix
Status: newclosed

The unordered list filter will stay as it is (for backwards compatibility reasons, at a minimum). It's only intended for simple cases and if you have more complex requirements, then writing a custom tag is absolutely the right thing to do. There are many different possibilities for how to turn a list of data into some kind of HTML list and one tag or filter cannot possibly cover all of them.

Closing as wontfix, since the proposal doesn't seem well formed at the moment. Initial design shouldn't be done in a ticket, since it won't involve the right audience. If you want to start a thread on django-developers, please do so. But I suspect you're trying to write a wrapper that will meet infinitely varied requirements, when custom template tags for specific situations are already easy enough to write.

comment:2 by (none), 15 years ago

milestone: post-1.0

Milestone post-1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top