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
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)
I get an AttributeError: 'list' object has no attribute 'model'
Is there a way to circumvent this, or should I try to do something
involving a generic relationship for the models (i.e., a model with
almost nothing to it, to which all the other models have a generic
relationship)? Will that kind o
Good to know! Since all the models have a DateTimeField "date"
operator should work. I'll let you know if it works.
On Aug 22, 4:23 pm, Doug B <[EMAIL PROTECTED]> wrote:
> q = list(a) + list(b) + list(c)
> q.sort('-date')
>
> The problem you have here is the q.sort() method doesn't understand
> h
q = list(a) + list(b) + list(c)
q.sort('-date')
The problem you have here is the q.sort() method doesn't understand
how to compare your objects. '-date' means nothing to it.I'm
pretty sure you need to write your own comparison function and pass
that to sort. If you've got models with the sam
On Aug 22, 2:10 pm, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:
> It's just an idea... you could cast to list and use extend.
For the list:
q = list(a) + list(b) + list(c)
q.sort('-date')
I'm unfamiliar, though with "extend." How do I use it?
--~--~-~--~~~---~--~~
Hi,
On 8/22/07, Drasty <[EMAIL PROTECTED]> wrote:
>
> Is there a way to concatenate model querysets and use the
> concatenation as the basis for a date-based generic view? Or, would I
> be able to mimic the generic view code but alter it in such a way that
> it handles the concatenation?
>
> (Eac
Is there a way to concatenate model querysets and use the
concatenation as the basis for a date-based generic view? Or, would I
be able to mimic the generic view code but alter it in such a way that
it handles the concatenation?
(Each of the models would have a DateTimeField called "date")
E.g.
8 matches
Mail list logo