Opened 6 years ago

Closed 16 months ago

#13771 closed Bug (duplicate)

ForeignKey and Many2Many validation fails between databases

Reported by: jdetaeye Owned by: Andrii Kurinnyi
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords: multidb
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

The validation of ForeignKey and Many2Many fields isn't selecting the right database. The validity of the PKs in the referenced table is always checked in the database chosen by the _default_manager. If that database is different than the one containing the model_instance, this validation check is incorrect.

See http://groups.google.com/group/django-users/browse_thread/thread/639df3f9412ef1d3#

Attachments (2)

related_field_validation.patch (1.2 KB) - added by jdetaeye 6 years ago.
partial patch
t13771_1.diff (1.9 KB) - added by Andrii Kurinnyi 6 years ago.
Added test for foreign key validation

Download all attachments as: .zip

Change History (11)

Changed 6 years ago by jdetaeye

partial patch

comment:1 Changed 6 years ago by jdetaeye

Patch needs improvement: set

comment:2 Changed 6 years ago by Russell Keith-Magee

Needs tests: set
Triage Stage: UnreviewedAccepted

Changed 6 years ago by Andrii Kurinnyi

Attachment: t13771_1.diff added

Added test for foreign key validation

comment:3 Changed 6 years ago by Andrii Kurinnyi

Has patch: set
Needs tests: unset

isValidIDList method on ManyToManyField, mentioned in previous patch dosn't seem to be used anywhere in Django, and hasn't been updated since magic-removal branch got merged.
It looks like it was used in ManyToManyField constructor before, but it is not used now.

comment:4 Changed 6 years ago by Andrii Kurinnyi

Owner: changed from nobody to Andrii Kurinnyi
Status: newassigned

comment:5 Changed 6 years ago by Graham King

Severity: Normal
Type: Bug

comment:6 Changed 5 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

comment:11 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:12 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:13 Changed 16 months ago by Tim Graham

Resolution: duplicate
Status: assignedclosed

Seems to be a duplicate of #14691 which was fixed in 1.3.

Note: See TracTickets for help on using tickets.
Back to Top