#27477: Use QuerySet.select_for_update() in admin change form to fix race 
condition
-----------------------------------------+------------------------
               Reporter:  Dave Hall      |          Owner:  nobody
                   Type:  New feature    |         Status:  new
              Component:  contrib.admin  |        Version:  master
               Severity:  Normal         |       Keywords:  admin
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 There is a race condition in the admin change form where a user can edit a
 model instance at the same time as another user. Consider the following
 two operations occurring in parallel:

 1. `ModelAdmin.change_view()`
 2. `User.objects.update(is_superuser=True)`

 If (1) load the model instance, then (2) runs, then (1) saves the model
 instance, the update in (2) will be lost.

 The solution is to call `select_for_update` on the queryset in the
 `changeform_view()` method of `ModelAdmin`.

--
Ticket URL: <https://code.djangoproject.com/ticket/27477>
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.1d790e6dbc86293b2bd5965bd871c270%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to