[Django] #26170: Admin.ModelAdmin incorrectly works with multiple databases

11 views
Skip to first unread message

Django

unread,
Feb 3, 2016, 5:37:30 AM2/3/16
to django-...@googlegroups.com
#26170: Admin.ModelAdmin incorrectly works with multiple databases
-------------------------------+----------------------------------
Reporter: juntatalor | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.9
Severity: Normal | Keywords: admin multi database
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+----------------------------------
When settings.DATABASES 'default' key is set to empty dict Django Admin
tries to perform transaction.atomic on dummy database, and it ends in
raising exception, when trying to change, add or delete record.

ModelAdmin functions that use transaction.atomic:
https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1393
https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1660

"using" argument (taken from db routers) should be specified for
transaction.atomic

Patch: https://github.com/django/django/pull/6076

--
Ticket URL: <https://code.djangoproject.com/ticket/26170>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 3, 2016, 8:31:33 AM2/3/16
to django-...@googlegroups.com
#26170: ModelAdmin add/change/delete views always run transaction on default
database
--------------------------------------+------------------------------------

Reporter: juntatalor | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.9
Severity: Normal | Resolution:
Keywords: admin multi database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_docs: => 0
* needs_better_patch: => 0
* needs_tests: => 1
* stage: Unreviewed => Accepted


Comment:

Patch needs tests. Looks like this also affects
`django/contrib/auth/admin.py`.

--
Ticket URL: <https://code.djangoproject.com/ticket/26170#comment:1>

Django

unread,
Sep 5, 2016, 2:53:54 PM9/5/16
to django-...@googlegroups.com
#26170: ModelAdmin add/change/delete views always run transaction on default
database
--------------------------------------+------------------------------------
Reporter: juntatalor | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: admin multi database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by charettes):

* needs_better_patch: 0 => 1
* version: 1.9 => master
* needs_tests: 1 => 0


Comment:

The new [https://github.com/django/django/pull/7143 PR] includes tests but
doesn't deal with the `django/contrib/auth/admin.py` instance yet.

--
Ticket URL: <https://code.djangoproject.com/ticket/26170#comment:2>

Django

unread,
Sep 7, 2016, 3:34:08 PM9/7/16
to django-...@googlegroups.com
#26170: ModelAdmin add/change/delete views always run transaction on default
database
--------------------------------------+------------------------------------
Reporter: juntatalor | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin multi database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/26170#comment:3>

Django

unread,
Sep 14, 2016, 4:07:00 PM9/14/16
to django-...@googlegroups.com
#26170: ModelAdmin add/change/delete views always run transaction on default
database
--------------------------------------+------------------------------------
Reporter: juntatalor | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: admin multi database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"9459ec82aa12cad9b859c54c2f33f50bec057f2e" 9459ec8]:
{{{
#!CommitTicketReference repository=""
revision="9459ec82aa12cad9b859c54c2f33f50bec057f2e"
Fixed #26170 -- Made ModelAdmin views run transactions on the correct
database.

Thanks juntatalor for the initial patch.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26170#comment:4>

Reply all
Reply to author
Forward
0 new messages