I'll give it a shot.
One alternative I think could work for me is to use just one model for
each of the (current) models I'm trying to merge in the view, with a
bunch of fields that are flagged with "blank=True." This makes
ordering them in generic views very easy, but I don't like the
prospects of having a bunch of extra fields in my Admin form. (I'm
relatively agnostic to multiple empty fields in a db table, though.)
Would there be a way to take one model and have multiple ways to
display it in the Admin? (E.g., the model "Entry" might appear as if
it were these models: Entry, Thought, Link, Image?)
I'm leaning toward just using one model with a choice list for
filtering by "kind" of data in a table row, since handling that model
is within my current level of technical "expertise" (ha!).
Thanks for your help!
On Aug 23, 12:20 pm, Doug B <[EMAIL PROTECTED]> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---