From d28a63cc008c2b62d1e82ecb5ff5a2d92e6a43ec Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 29 Jan 2007 16:09:25 +0000 Subject: Fixed #3389 -- Many-to-many sets can now be assigned with primary key values git-svn-id: http://code.djangoproject.com/svn/django/trunk@4448 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/modeltests/many_to_many/models.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/modeltests/many_to_many/models.py b/tests/modeltests/many_to_many/models.py index 38f8931ee7..5e46ad428d 100644 --- a/tests/modeltests/many_to_many/models.py +++ b/tests/modeltests/many_to_many/models.py @@ -203,7 +203,19 @@ __test__ = {'API_TESTS':""" >>> p2.article_set.all() [] -# Recreate the article and Publication we just deleted. +# Relation sets can also be set using primary key values +>>> p2.article_set = [a4.id, a5.id] +>>> p2.article_set.all() +[, ] +>>> a4.publications.all() +[] +>>> a4.publications = [p3.id] +>>> p2.article_set.all() +[] +>>> a4.publications.all() +[] + +# Recreate the article and Publication we have deleted. >>> p1 = Publication(id=None, title='The Python Journal') >>> p1.save() >>> a2 = Article(id=None, headline='NASA uses Python') -- cgit v1.3