#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
-------------------------------------+-------------------------------------
Changes (by raydeal):

 * owner:  (none) => raydeal
 * status:  new => assigned


Comment:

 After investigation of this ticket and #7488 conclusion is:
 Issue in the #7488 ticket is obsolete. It is about {{{ get_querystet }}}
 code that haven't existed since 2008.
 Time line is as follow:
 19-07-2008 newform-admin was merged with main branch
 23-07-2008 #7488 ticket was closed
 14-11-2008 the {{{ BaseInlineFormSet.get_queryset }}} code
 (forms/models.py) mentioned in #7488 was deleted in #9076 (not closed yet
 ???) (https://code.djangoproject.com/ticket/9076#comment:22) and queryset
 moved to
 {{{
 BaseInlineFormSet.__init__
 }}}
 
https://github.com/django/django/commit/bca14cd3c8685f0c8d6a24583e3de33f94f8910b
 #diff-360e00ebf46ef996c61729321d5a59992d78be2ad6913fb546394c2817b3837a
 28-12-2012 this code was changed #19524
 20-11-2013 this code was changed #21472
 Now the code is

 {{{
         if self.instance.pk is not None:
             qs = queryset.filter(**{self.fk.name: self.instance})
         else:
             qs = queryset.none()
 }}}
 It means that passing of unsaved object to related filter in admin Inlines
 is already solved. Ticket #9076 might be closed.

 Apart from this, the test
 
https://github.com/django/django/blob/4f8c7fd9d91b35e2c2922de4bb50c8c8066cbbc6/tests/model_inheritance_regress/tests.py#L185
 could be renamed and used as it was in
 
[https://github.com/django/django/pull/12768/files/fe4eab0a800cb9bd061d14fb58adea82ef74ef5c#r412762330
 PR]

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31486#comment:8>
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.a89ef3b3c23b189ef3cc4c8622f468df%40djangoproject.com.

Reply via email to