summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-01-14 14:55:36 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-01-14 14:55:36 +0000
commit2b2db12032e47229a9d9af28b05a07648f3fef93 (patch)
tree07ab87d01a43a17d4fd7f79ad5aeddb862c286f6 /tests
parent373076a3ccd87d8e4489392e16943914141ff856 (diff)
Fixed #12386 -- Corrected the column names produced for autogenerated m2m tables when the related table is specified as a dot-separated string. Thanks to ldevesine for the report and simonb for the extra test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12226 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/model_package/tests.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/modeltests/model_package/tests.py b/tests/modeltests/model_package/tests.py
index 7fd4b6f679..4d154c14fa 100644
--- a/tests/modeltests/model_package/tests.py
+++ b/tests/modeltests/model_package/tests.py
@@ -50,6 +50,31 @@ __test__ = {'API_TESTS': """
>>> ad.publications.count()
1
+# Regression for #12386 - field names on the autogenerated intermediate class
+# that are specified as dotted strings don't retain any path component for the
+# field or column name
+
+>>> Article.publications.through._meta.fields[1].name
+'article'
+
+>>> Article.publications.through._meta.fields[1].get_attname_column()
+('article_id', 'article_id')
+
+>>> Article.publications.through._meta.fields[2].name
+'publication'
+
+>>> Article.publications.through._meta.fields[2].get_attname_column()
+('publication_id', 'publication_id')
+
+>>> Article._meta.get_field('publications').m2m_db_table()
+'model_package_article_publications'
+
+>>> Article._meta.get_field('publications').m2m_column_name()
+'article_id'
+
+>>> Article._meta.get_field('publications').m2m_reverse_name()
+'publication_id'
+
"""}