Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #14691 -- Made ForeignKey.validate() use the right data…

…base. Thanks Marco Paolini for the report.

Backport of [14580] from trunk

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

0 notes on commit 746ce7d

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