Try: ContentType.objects.filter( (Q(app_label__exact='aiyo') & Q(model__exact='content')) | (Q(app_label__exact='aiyo') & Q(model__exact='product')) )
Regards, -scott On Sat, 2006-06-24 at 09:06 -0700, nkeric wrote: > sqlite> select * from django_content_type where (app_label='aiyo' and > model='content') or (app_label='aiyo' and model='product'); > 17|Product|aiyo|product > 24|Content|aiyo|content > > hi all, > > I've tried: > > ContentType.objects.filter(Q(app_label__exact='aiyo', > model__exact='content') | Q(app_label__exact='aiyo', > model__exact='product')) > > result in: > > SELECT > "django_content_type"."id","django_content_type"."name","django_content_type"."app_label","django_content_type"."model" > FROM "django_content_type" WHERE (("django_content_type"."app_label" = > aiyo OR "django_content_type"."model" = content OR > "django_content_type"."app_label" = aiyo OR > "django_content_type"."model" = product)) ORDER BY > "django_content_type"."name" ASC > > it just OR'd everything together; > > and: > > ContentType.objects.filter(Q(app_label__exact='aiyo', > model__exact='content'), Q(app_label__exact='aiyo', > model__exact='product')) > > which ends with: > > SELECT > "django_content_type"."id","django_content_type"."name","django_content_type"."app_label","django_content_type"."model" > FROM "django_content_type" WHERE (("django_content_type"."app_label" = > aiyo AND "django_content_type"."model" = content AND > "django_content_type"."app_label" = aiyo AND > "django_content_type"."model" = product)) ORDER BY > "django_content_type"."name" ASC > > now it AND'd everything :( > > what I need is: > > ...WHERE > ("django_content_type"."app_label" = aiyo AND > "django_content_type"."model" = content) > OR > ("django_content_type"."app_label" = aiyo AND > "django_content_type"."model" = product)... > > how could I do that? > > TIA :) > > regards, > > eric > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---