#34589: exclude does not support nested ForeignKey relationship
-------------------------------------+-------------------------------------
Reporter: ftamy9 | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Old description:
> 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)
> )
New description:
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)
)
}}}
--
Comment (by David Sanders):
formatted description
--
Ticket URL: <https://code.djangoproject.com/ticket/34589#comment:1>
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/010701884344b306-99ae3f0a-7a15-42d5-a345-253ecbb2076d-000000%40eu-central-1.amazonses.com.