Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 2b2db12032e47229a9d9af28b05a07648f3fef93 1 parent 373076a
Russell Keith-Magee authored January 14, 2010
2  django/db/models/fields/related.py
@@ -881,8 +881,8 @@ def create_many_to_many_intermediary_model(field, klass):
25  tests/modeltests/model_package/tests.py
@@ -50,6 +50,31 @@ class Meta:
50 50
 >>> ad.publications.count()
51 51
 1
52 52
 
  53
+# Regression for #12386 - field names on the autogenerated intermediate class
  54
+# that are specified as dotted strings don't retain any path component for the
  55
+# field or column name
  56
+
  57
+>>> Article.publications.through._meta.fields[1].name
  58
+'article'
  59
+
  60
+>>> Article.publications.through._meta.fields[1].get_attname_column()
  61
+('article_id', 'article_id')
  62
+
  63
+>>> Article.publications.through._meta.fields[2].name
  64
+'publication'
  65
+
  66
+>>> Article.publications.through._meta.fields[2].get_attname_column()
  67
+('publication_id', 'publication_id')
  68
+
  69
+>>> Article._meta.get_field('publications').m2m_db_table()
  70
+'model_package_article_publications'
  71
+
  72
+>>> Article._meta.get_field('publications').m2m_column_name()
  73
+'article_id'
  74
+
  75
+>>> Article._meta.get_field('publications').m2m_reverse_name()
  76
+'publication_id'
  77
+
53 78
 """}
54 79
 
55 80
 

0 notes on commit 2b2db12

Please sign in to comment.
Something went wrong with that request. Please try again.