Re: [Django] #33912: In the admin, saving an object in a non-default DB with unique field fails when the default DB contains an object with the same unique field value but different PK

8 views
Skip to first unread message

Django

unread,
Aug 10, 2022, 7:00:48 AM8/10/22
to django-...@googlegroups.com
#33912: In the admin, saving an object in a non-default DB with unique field fails
when the default DB contains an object with the same unique field value but
different PK
----------------------------------+--------------------------------------
Reporter: François Granade | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution:
Keywords: admin multi-db | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------

Comment (by François Granade):

indeed, that's the same issue as #15130 . I'm attaching a patch that fixes
it , but it doesn't include a test.

I can write a test to get the patch accepted, but I would need some
guidance on writing the test: I cannot find example of tests that deal
with the admin *and* with multiple database, so I don't know how to write
it... Could someone with experience point me to some example of tests I
could copy/reuse, or to a general idea of how to write a test on the admin
with multiple databases ? Thanks in advance.

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

Django

unread,
Aug 10, 2022, 7:01:30 AM8/10/22
to django-...@googlegroups.com
#33912: In the admin, saving an object in a non-default DB with unique field fails
when the default DB contains an object with the same unique field value but
different PK
----------------------------------+--------------------------------------
Reporter: François Granade | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution:
Keywords: admin multi-db | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by François Granade):

* Attachment "patch_33912.diff" added.

simple patch that fixes the problem. See comments on why it doesn't
include a test (yet..)

--
Ticket URL: <https://code.djangoproject.com/ticket/33912>

Django

unread,
Aug 10, 2022, 7:03:12 AM8/10/22
to django-...@googlegroups.com
#33912: In the admin, saving an object in a non-default DB with unique field fails
when the default DB contains an object with the same unique field value but
different PK
----------------------------------+--------------------------------------
Reporter: François Granade | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution: duplicate

Keywords: admin multi-db | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

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


Comment:

Duplicate of #15130. Please leave comments in the original ticket.

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

Reply all
Reply to author
Forward
0 new messages