mirror of
https://github.com/django/django.git
synced 2025-04-25 17:54:37 +00:00
Switched to using the standard method for comparing querysets in teh templates.
This commit is contained in:
parent
7515f6576b
commit
0955d16a16
@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import pickle
|
import pickle
|
||||||
|
from operator import attrgetter
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
@ -873,10 +874,10 @@ class QueryTestCase(TestCase):
|
|||||||
dive = Book.objects.using('other').create(title="Dive into Python",
|
dive = Book.objects.using('other').create(title="Dive into Python",
|
||||||
published=datetime.date(2009, 5, 4))
|
published=datetime.date(2009, 5, 4))
|
||||||
val = Book.objects.db_manager("other").raw('SELECT id FROM multiple_database_book')
|
val = Book.objects.db_manager("other").raw('SELECT id FROM multiple_database_book')
|
||||||
self.assertEqual(map(lambda o: o.pk, val), [dive.pk])
|
self.assertQuerysetEqual(val, [dive.pk], attrgetter("pk"))
|
||||||
|
|
||||||
val = Book.objects.raw('SELECT id FROM multiple_database_book').using('other')
|
val = Book.objects.raw('SELECT id FROM multiple_database_book').using('other')
|
||||||
self.assertEqual(map(lambda o: o.pk, val), [dive.pk])
|
self.assertQuerysetEqual(val, [dive.pk], attrgetter("pk"))
|
||||||
|
|
||||||
def test_select_related(self):
|
def test_select_related(self):
|
||||||
"Database assignment is retained if an object is retrieved with select_related()"
|
"Database assignment is retained if an object is retrieved with select_related()"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user