﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34589	exclude does not support nested ForeignKey relationship	ftamy9	nobody	"I need to find trips that are not `trip__method__title=ShippingChoice.ORGANIZATION`
my code is like this:

{{{
    working_shipments = Shipment.objects.exclude(
        state__in=[
            ShipmentStateChoices.CANCELLED,
            ShipmentStateChoices.DELIVERED
        ],
        trip__method__title=ShippingChoice.ORGANIZATION
    ).filter(
        updated_at__lt=time_threshold,
    )
}}}

I forced to use a big list on filter instead to use the exclude. my code is like this:

{{{
    working_shipments = Shipment.objects.exclude(
        state__in=[
            ShipmentStateChoices.CANCELLED,
            ShipmentStateChoices.DELIVERED
        ]
    ).filter(
        updated_at__lt=time_threshold,
        trip__method__title__in=(ShippingChoice.ALO,  ShippingChoice.SNAP, ShippingChoice.MIAREH)  
    )

}}}"	Bug	new	Database layer (models, ORM)	4.2	Normal				Unreviewed	0	0	0	0	0	0
