Ticket #12386: 12386.diff

File 12386.diff, 1.9 KB (added by ramiro, 5 years ago)

Test case demonstrating I can't reproduce this

  • new file tests/regressiontests/model_package_regress/__init__.py

    diff -r f886ea8cfadf tests/regressiontests/model_package_regress/__init__.py
    - +  
     1
  • new file tests/regressiontests/model_package_regress/models/__init__.py

    diff -r f886ea8cfadf tests/regressiontests/model_package_regress/models/__init__.py
    - +  
     1# Import all the models from subpackages
     2from article import Article, Publication
  • new file tests/regressiontests/model_package_regress/models/article.py

    diff -r f886ea8cfadf tests/regressiontests/model_package_regress/models/article.py
    - +  
     1from django.db import models
     2
     3class Publication(models.Model):
     4    title = models.CharField(max_length=30)
     5
     6    class Meta:
     7        app_label = 'model_package_regress'
     8
     9
     10class Article(models.Model):
     11    headline = models.CharField(max_length=100)
     12    publications = models.ManyToManyField(Publication, null=True, blank=True,)
     13
     14    class Meta:
     15        app_label = 'model_package_regress'
  • new file tests/regressiontests/model_package_regress/tests.py

    diff -r f886ea8cfadf tests/regressiontests/model_package_regress/tests.py
    - +  
     1#from django.db import models
     2
     3__test__ = {'API_TESTS': """
     4>>> from models.article import Article, Publication
     5
     6>>> Publication._meta.db_table
     7'model_package_regress_publication'
     8
     9>>> Article._meta.db_table
     10'model_package_regress_article'
     11
     12>>> for f in Article._meta.local_many_to_many:
     13...     if f.name == 'publications':
     14...         break
     15
     16>>> f.m2m_db_table()
     17'model_package_regress_article_publications'
     18
     19>>> f.m2m_column_name()
     20'article_id'
     21
     22>>> f.m2m_reverse_name()
     23'publication_id'
     24
     25"""}
     26
     27
Back to Top