summaryrefslogtreecommitdiff
path: root/tests/modeltests
diff options
context:
space:
mode:
authorJason Pellerin <jpellerin@gmail.com>2006-07-16 23:11:33 +0000
committerJason Pellerin <jpellerin@gmail.com>2006-07-16 23:11:33 +0000
commit541ac3b990903056afaecd30ca013c39775fd9c5 (patch)
treeedb2c61940d74240a80dcaa11ec1589d893c50cc /tests/modeltests
parent49ce784805b9db3cc7523f2c391cc67f934dddca (diff)
[multi-db] Merge trunk to [3354]
git-svn-id: http://code.djangoproject.com/svn/django/branches/multiple-db-support@3355 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests')
-rw-r--r--tests/modeltests/m2m_and_m2o/models.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/modeltests/m2m_and_m2o/models.py b/tests/modeltests/m2m_and_m2o/models.py
index 7a685ecbd2..f43fb12d9e 100644
--- a/tests/modeltests/m2m_and_m2o/models.py
+++ b/tests/modeltests/m2m_and_m2o/models.py
@@ -28,24 +28,23 @@ API_TESTS = """
>>> r.save()
>>> g = User(username='gustav')
>>> g.save()
+
>>> i = Issue(num=1)
>>> i.client = r
->>> i.validate()
-{}
>>> i.save()
+
>>> i2 = Issue(num=2)
>>> i2.client = r
->>> i2.validate()
-{}
>>> i2.save()
>>> i2.cc.add(r)
+
>>> i3 = Issue(num=3)
>>> i3.client = g
->>> i3.validate()
-{}
>>> i3.save()
>>> i3.cc.add(r)
+
>>> from django.db.models.query import Q
+
>>> Issue.objects.filter(client=r.id)
[<Issue: 1>, <Issue: 2>]
>>> Issue.objects.filter(client=g.id)
@@ -55,8 +54,8 @@ API_TESTS = """
>>> Issue.objects.filter(cc__id__exact=r.id)
[<Issue: 2>, <Issue: 3>]
-# Queries that combine results from the m2m and the m2o relationship.
-# 3 ways of saying the same thing:
+# These queries combine results from the m2m and the m2o relationships.
+# They're three ways of saying the same thing.
>>> Issue.objects.filter(Q(cc__id__exact=r.id) | Q(client=r.id))
[<Issue: 1>, <Issue: 2>, <Issue: 3>]
>>> Issue.objects.filter(cc__id__exact=r.id) | Issue.objects.filter(client=r.id)