#31486: Deprecate passing unsaved objects to related filters.
-------------------------------------+-------------------------------------
     Reporter:  Mapiarz              |                    Owner:  raydeal
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by raydeal):

 Replying to [comment:4 Hasan Ramezani]:
 > As I [https://github.com/django/django/pull/12768#discussion_r412815335
 commented on PR]:
 >
 > I don't know how to distinguish between `p2.choice_set.all()` and
 `Choice.objects.filter(poll=p2)`, It seems `get_normalized_value` receives
 the same (value and lhs) for these both cases.
 >
 > I've also tried to implement it in  `RelatedLookupMixin.get_prep_lookup`
 based on
 [https://github.com/django/django/pull/12768#discussion_r412882870 Mariusz
 comment on PR], but still same problem. the `lhs` and `rhs` have the same
 value in `p2.choice_set.all()` and `Choice.objects.filter(poll=p2)` cases.
 After looking at code and trying implement solution, my conclusion is: it
 is connected with #19580, if FK raises ValueError like M2M does it will
 open door to fix this without a struggle how to distinguish between
 `p2.choice_set.all()` and `Choice.objects.filter(poll=p2)` because first
 case will raise ValueError before `filter` is evaluated.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31486#comment:9>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.4a78477f7446e2e61324550e7e54e2b6%40djangoproject.com.

Reply via email to