Opened 9 years ago
Closed 8 years ago
#26170 closed Bug (fixed)
ModelAdmin add/change/delete views always run transaction on default database
Reported by: | juntatalor | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | admin multi database |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
Change History (4)
comment:1 by , 9 years ago
Needs tests: | set |
---|---|
Summary: | Admin.ModelAdmin incorrectly works with multiple databases → ModelAdmin add/change/delete views always run transaction on default database |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 8 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | set |
Version: | 1.9 → master |
The new PR includes tests but doesn't deal with the django/contrib/auth/admin.py
instance yet.
comment:3 by , 8 years ago
Patch needs improvement: | unset |
---|
Patch needs tests. Looks like this also affects
django/contrib/auth/admin.py
.