Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #14691 -- Made ForeignKey.validate() use the right database. Th…

…anks Marco Paolini for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14580 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f3d07047834b0a4ea3bde2b46643b327a659364e 1 parent ea14592
Ramiro Morales authored November 16, 2010
5  django/db/models/fields/related.py
@@ -835,7 +835,10 @@ def validate(self, value, model_instance):
6  tests/regressiontests/multiple_database/tests.py
@@ -581,6 +581,12 @@ def test_foreign_key_deletion(self):
581 581
         self.assertEquals(Person.objects.using('other').count(), 0)
582 582
         self.assertEquals(Pet.objects.using('other').count(), 0)
583 583
 
  584
+    def test_foreign_key_validation(self):
  585
+        "ForeignKey.validate() uses the correct database"
  586
+        mickey = Person.objects.using('other').create(name="Mickey")
  587
+        pluto = Pet.objects.using('other').create(name="Pluto", owner=mickey)
  588
+        self.assertEquals(None, pluto.full_clean())
  589
+
584 590
     def test_o2o_separation(self):
585 591
         "OneToOne fields are constrained to a single database"
586 592
         # Create a user and profile on the default database

0 notes on commit f3d0704

Please sign in to comment.
Something went wrong with that request. Please try again.