From 5bd01187d487a17448bb5d8b2b2c32cc8b56ee48 Mon Sep 17 00:00:00 2001 From: arthur Date: Sat, 7 May 2016 21:36:43 +0200 Subject: [PATCH] Fix nested object test --- example/blog/tests/test_nestedobjects.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/example/blog/tests/test_nestedobjects.py b/example/blog/tests/test_nestedobjects.py index 1501906..46e4ff1 100644 --- a/example/blog/tests/test_nestedobjects.py +++ b/example/blog/tests/test_nestedobjects.py @@ -1,4 +1,4 @@ -from django.db import DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, router from django.test import TestCase from djadmin2.utils import NestedObjects @@ -66,7 +66,8 @@ class NestedObjectsTests(TestCase): Check that the nested collector doesn't query for DO_NOTHING objects. """ objs = [Event.objects.create()] - n = NestedObjects(using=None) + using = router.db_for_write(Event._meta.model) + n = NestedObjects(using=using) EventGuide.objects.create(event=objs[0]) with self.assertNumQueries(2): # One for Location, one for Guest, and no query for EventGuide