#34589: exclude does not support nested ForeignKey relationship
-------------------------------------+-------------------------------------
Reporter: ftamy9 | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 4.2
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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)
)
--
Ticket URL: <https://code.djangoproject.com/ticket/34589>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070188433e6009-c7b39311-db98-4253-8660-23959b8b8984-000000%40eu-central-1.amazonses.com.