Opened 14 years ago

Closed 9 years 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: dev
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 14 years ago.
partial patch
t13771_1.diff (1.9 KB ) - added by Andrii Kurinnyi 14 years ago.
Added test for foreign key validation

Download all attachments as: .zip

Change History (11)

by jdetaeye, 14 years ago

partial patch

comment:1 by jdetaeye, 14 years ago

Patch needs improvement: set

comment:2 by Russell Keith-Magee, 14 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

by Andrii Kurinnyi, 14 years ago

Attachment: t13771_1.diff added

Added test for foreign key validation

comment:3 by Andrii Kurinnyi, 14 years ago

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 by Andrii Kurinnyi, 14 years ago

Owner: changed from nobody to Andrii Kurinnyi
Status: newassigned

comment:5 by Graham King, 13 years ago

Severity: Normal
Type: Bug

comment:6 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

comment:11 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:12 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:13 by Tim Graham, 9 years ago

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