What I gave you should work, I have no idea about the error your
getting. Here is a complete example, maybe that will help.
In [15]: ls1=cm.Listing.objects.all()[:2]
In [16]: ls2=cm.Listing.objects.all()[10:13]
In [17]: fs3=cm.Field.objects.all()[:2]
In [18]: q=list(ls1) + list(ls2) + list(fs3)
In [19]: sorted_list=sorted(q,key=operator.attrgetter('modified'))
In [20]: sorted_list
Out[20]:
[<Field: 179|SUBDIVISION|Subdivision|Harrisburg>,
<Listing: 305748>,
<Field: 198|USERDEFINED10|Senior Sch|Harrisburg>,
<Listing: 306528>,
<Listing: 302041>,
<Listing: 305518>,
<Listing: 304160>]
As for other options, it depends on what you are doing. Generic
relations aren't too bad, unless you want to filter on them. I had
some complex needs for an event calendar, and went with a wrapper
class. MyWrapper(list(ls1) + list(ls2) + list(fs3)). The wrapper
went through the objects and put them in the right slots and extracted
the display information from a dummy class on each model (like having
class Admin: in the model for admin) to pass to a template tag for
rendering the event.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---