#32137: Change message describing the deletion of inline objects in admin has 
no id
available
-------------------------------------+-------------------------------------
     Reporter:  Vlada Macek          |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  contrib.admin        |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Richard Laager):

 * cc: Richard Laager (added)
 * status:  closed => new
 * has_patch:  0 => 1
 * resolution:  needsinfo =>


Comment:

 Replying to [comment:3 Mariusz Felisiak]:
 > We could create a copy of `obj` before deletion:
 > ...code snipped...
 > but I'm not sure it's worth complexity.

 I just ran into this issue. That change (with the obvious addition of
 `import copy`) works as expected. Adding a copy doesn't seem particularly
 complex to me.

 I don't see an easier way to fix it. `save_existing_objects()` takes a
 `commit` argument, but 1) passing down `commit=False` would be complicated
 (and it seems like that would end up breaking compatibility in
 `ModelAdmin.save_formset()`), 2) that probably has non-trivial
 consequences, and 3) the deletions still need to happen, so then something
 needs to do that (possibly a second call to `save_existing_objects()` with
 `commit=True`, but then we're creating another round of the first two
 concerns).

 Note that the scenario under which this occurs ("Sometimes the developer
 wishes the id to be a part of the Model.__str__.") is literally the
 default. `Model.__str__()` is:
 {{{
     def __str__(self):
         return '%s object (%s)' % (self.__class__.__name__, self.pk)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32137#comment:4>
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/0107018040652670-75ef6fae-ba80-488d-9fd2-285f9f866999-000000%40eu-central-1.amazonses.com.

Reply via email to