#14691 closed (fixed)
foreign key validate() fails for non-default databases
Reported by: | marcop | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | validation, foreign key, mutiple_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
to reproduce:
- configure two databases:
default
andother
- have two models Person and Pet:
class Person(models.Model): name = models.CharField(max_length=100) class Pet(models.Model): name = models.CharField(max_length=100) owner = models.ForeignKey(Person)
- create Person instance named
person
in database 'other' - create Pet instance named
pet
in database 'other' - try calling
pet.full_clean()
or, more specifically,pet._meta.get_field('owner').validate(person.pk, person)
patch and test attached
Attachments (3)
Change History (7)
by , 14 years ago
Attachment: | multidb_foreignkey_validation_patch.diff added |
---|
by , 14 years ago
Attachment: | multidb_management_tests.diff added |
---|
by , 14 years ago
Attachment: | 14691.diff added |
---|
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
Seems multidb_management_tests.diff
you a attached are actually tests for other ticket you opened #14662.
Attached another patch that only adds tests.
comment:3 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 14 years ago
Note:
See TracTickets
for help on using tickets.
Patch with tests