Opened 13 months ago

Last modified 13 months ago

#34589 closed Bug

exclude does not support nested ForeignKey relationship — at Initial Version

Reported by: ftamy9 Owned by: nobody
Component: Database layer (models, ORM) Version: 4.2
Severity: Normal Keywords: 4.1
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I need to find trips that are not tripmethodtitle=ShippingChoice.ORGANIZATION
my code is like this:

working_shipments = Shipment.objects.exclude(

statein=[

ShipmentStateChoices.CANCELLED,
ShipmentStateChoices.DELIVERED

],
tripmethodtitle=ShippingChoice.ORGANIZATION

).filter(

updated_atlt=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(

statein=[

ShipmentStateChoices.CANCELLED,
ShipmentStateChoices.DELIVERED

]

).filter(

updated_atlt=time_threshold,
trip
methodtitlein=(ShippingChoice.ALO, ShippingChoice.SNAP, ShippingChoice.MIAREH)

)

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top