summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2008-06-12 04:13:16 +0000
committerAdrian Holovaty <adrian@holovaty.com>2008-06-12 04:13:16 +0000
commit5309e18cbfc85823d1c58e389fd122fff6e17eea (patch)
treed02afd7f04e4cbe2e145d666f7a727545596d3c2 /tests
parent0fd41d63e2ace4f873c3d2830cc51c37b3c043de (diff)
Fixed #7026 -- Fixed misleading/incorrect exception text when adding to a many-to-many set on an object that doesn't yet have a primary-key value. Thanks for the report, ryan@peaceworks.ca
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7622 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/many_to_many/models.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/modeltests/many_to_many/models.py b/tests/modeltests/many_to_many/models.py
index e09fd825f8..c2ab2897b6 100644
--- a/tests/modeltests/many_to_many/models.py
+++ b/tests/modeltests/many_to_many/models.py
@@ -39,6 +39,14 @@ __test__ = {'API_TESTS':"""
# Create an Article.
>>> a1 = Article(id=None, headline='Django lets you build Web apps easily')
+
+# You can't associate it with a Publication until it's been saved.
+>>> a1.publications.add(p1)
+Traceback (most recent call last):
+...
+ValueError: 'Article' instance needs to have a primary key value before a many-to-many relationship can be used.
+
+# Save it!
>>> a1.save()
# Associate the Article with a Publication.