Opened 5 years ago

Last modified 4 years ago

#13771 assigned Bug

ForeignKey and Many2Many validation fails between databases

Reported by: jdetaeye Owned by: andrewsk
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 5 years ago.
partial patch
t13771_1.diff (1.9 KB) - added by andrewsk 5 years ago.
Added test for foreign key validation

Download all attachments as: .zip

Change History (10)

Changed 5 years ago by jdetaeye

partial patch

comment:1 Changed 5 years ago by jdetaeye

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set

comment:2 Changed 5 years ago by russellm

  • Needs tests set
  • Triage Stage changed from Unreviewed to Accepted

Changed 5 years ago by andrewsk

Added test for foreign key validation

comment:3 Changed 5 years ago by andrewsk

  • 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 5 years ago by andrewsk

  • Owner changed from nobody to andrewsk
  • Status changed from new to assigned

comment:5 Changed 4 years ago by graham_king

  • Severity set to Normal
  • Type set to Bug

comment:6 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

comment:11 Changed 3 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:12 Changed 3 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

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