mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
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
This commit is contained in:
parent
373076a3cc
commit
2b2db12032
2 changed files with 26 additions and 1 deletions
|
@ -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'
|
||||
|
||||
"""}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue