#33579: Raise a specialized exception when Model.save(update_fields) does not
affect any rows
-------------------------------------+-------------------------------------
     Reporter:  Simon Charette       |                    Owner:  Dulalet
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  4.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 Another alternative we would be to simply raise a `base.DoesNotExists`
 error instead.

 It would be backward incompatible in the sense that a different exception
 type would be raised but it seems it would fit elegantly with the message
 it's meant to convey; the object that was attempted to be updated was not
 found. It would also make code that handles generic `DoesNotExist` and
 turn them into HTTP 404 automatically pick up errors of this form without
 any form of special casing.

 Another argument for this approach is that the affected ''base'' is
 already available from `Model._save_table` via the `cls` kwarg so it would
 also allow to differentiate which model row was missing when dealing with
 concrete model inheritance that require update against multiple tables.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33579#comment:7>
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/01070183616ba7ef-6e083c24-3376-48ad-be3d-a90d998a3a57-000000%40eu-central-1.amazonses.com.

Reply via email to