On 18 nov, 19:54, Ross Dakin <[EMAIL PROTECTED]> wrote:
> > Others already gave you practical answers, so this will be mostly a
> > more general ('conceptual' ?) advice: don't mix heterogenous data
> > (objects, whatever) in a list. If you have a compelling reason (ie :
> > ordering) to have heterogenous data, wrap them all in a same 'meta'
> > data structure.
>
> Agreed. The simplest solution might be to just wrap your single
> objects in dictionaries:
>
> my_list = [
> {single_object},
> {'one', 'two'},
> {single_object},
> {'one', 'two'},
> ]
Err... Actually, this is not correct Python code and will raise a
SyntaxError. Also, just wrapping objects in dicts wouldn't solve the
problem of having to test and branch in the template - which is
exactly the problem polymorphic dispatch is trying to avoid.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---