Code

Ticket #12386: 12386.txt

File 12386.txt, 1.9 KB (added by ldevesine, 4 years ago)

Slightly altered test case producing the issue

Line 
1diff -r f886ea8cfadf tests/regressiontests/model_package_regress/__init__.py
2--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
3+++ b/tests/regressiontests/model_package_regress/__init__.py   Sat Dec 19 11:41:33 2009 -0300
4@@ -0,0 +1,1 @@
5+
6diff -r f886ea8cfadf tests/regressiontests/model_package_regress/models/__init__.py
7--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
8+++ b/tests/regressiontests/model_package_regress/models/__init__.py    Sat Dec 19 11:41:33 2009 -0300
9@@ -0,0 +1,2 @@
10+# Import all the models from subpackages
11+from article import Article, Publication
12diff -r f886ea8cfadf tests/regressiontests/model_package_regress/models/article.py
13--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
14+++ b/tests/regressiontests/model_package_regress/models/article.py     Sat Dec 19 11:41:33 2009 -0300
15@@ -0,0 +1,15 @@
16+from django.db import models
17+
18+class Publication(models.Model):
19+    title = models.CharField(max_length=30)
20+
21+    class Meta:
22+        app_label = 'model_package_regress'
23+
24+
25+class Article(models.Model):
26+    headline = models.CharField(max_length=100)
27+    publications = models.ManyToManyField('model_package_regress.Publication', null=True, blank=True,)
28+
29+    class Meta:
30+        app_label = 'model_package_regress'
31diff -r f886ea8cfadf tests/regressiontests/model_package_regress/tests.py
32--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
33+++ b/tests/regressiontests/model_package_regress/tests.py      Sat Dec 19 11:41:33 2009 -0300
34@@ -0,0 +1,27 @@
35+#from django.db import models
36+
37+__test__ = {'API_TESTS': """
38+>>> from models.article import Article, Publication
39+
40+>>> Publication._meta.db_table
41+'model_package_regress_publication'
42+
43+>>> Article._meta.db_table
44+'model_package_regress_article'
45+
46+>>> for f in Article._meta.local_many_to_many:
47+...     if f.name == 'publications':
48+...         break
49+
50+>>> f.m2m_db_table()
51+'model_package_regress_article_publications'
52+
53+>>> f.m2m_column_name()
54+'article_id'
55+
56+>>> f.m2m_reverse_name()
57+'publication_id'
58+
59+"""}
60+
61+