Hey guys,

I don't suppose anybody has any ideas on this?

My current thinking is that I'm making the problem too complicated
perhaps and that I need to try another method. Does anyone have any
ideas of how I could achieve the same functionality another way?

For instance, although I'm intermixing A and B into the "clist", I
don't *HAVE* to, I mean I could have a separate list of B models on
another part of the site. For the functionality of the site and from a
user interface perspective, it would be great to intermix them - but
if it's going to be too much hassle then I suppose I could separate
them. It seems like giving up though! :-)

Thanks again,

Mike.

On Jul 21, 10:51 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I have two models (A and B) that I want to intermix into a QuerySet. I
> know this is not yet possible in Django, so I decided to work around
> the problem using a third model C as a generic "wrapper" that posesses
> a GenericForeignKey to either A or B.
>
> Now, I'd also like to filter records within A and B by various means,
> so I've been attempting something like this within a view:
>
> -------------
> content_A = ContentType.objects.get_for_model(A)
> content_B = ContentType.objects.get_for_model(B)
>
> clist = C.objects.filter(content_type=content_A)
> clist = clist | C.objects.filter(content_type=content_B)
> -------------
>
> That all works fine, but as soon as I try and filter the "clist" with
> something like this:
>
> -----------
> clist = C.objects.filter(content_type=content_A,
> content_object__property_on_A=some_property)
> -----------
>
> It throws an exception:
> "Cannot resolve keyword 'content_object' into field. Choices are:
> content_type, id, object_id, ***** "
>
> Having hunted around a bit I saw another post on here regarding ticket
> #6805:http://code.djangoproject.com/ticket/6805
>
> Am I to understand that I cannot actually use the content_object field
> as a filter parameter because it is dynamically generated? If so, is
> there a way around this somehow that isn't going to involve a rather
> nasty set of looped hits on the database?
>
> Thanks for reading! If you need me to clarify a little more, then I
> certainly will.
>
> Mike.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to