diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-11-20 00:59:38 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-11-20 00:59:38 +0000 |
| commit | 660f9086f15c7c1f76b489ea885223b36494e7fd (patch) | |
| tree | 4fb789c790e4dcc4a8f427d3671771042b7c6fef /tests | |
| parent | e6b4d1014e9dd6096d6c8e312a3f82933441200f (diff) | |
Fixed #12245 -- Corrected target app handling for auto-generated m2m models when the parent model isn't in the models module (or a subpackage thereof). Thanks to emulbreh for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11755 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/modeltests/model_package/tests.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/modeltests/model_package/tests.py b/tests/modeltests/model_package/tests.py index 6e8c158a68..7fd4b6f679 100644 --- a/tests/modeltests/model_package/tests.py +++ b/tests/modeltests/model_package/tests.py @@ -1,4 +1,13 @@ -""" +from django.db import models + +class Advertisment(models.Model): + customer = models.CharField(max_length=100) + publications = models.ManyToManyField("model_package.Publication", null=True, blank=True) + + class Meta: + app_label = 'model_package' + +__test__ = {'API_TESTS': """ >>> from models.publication import Publication >>> from models.article import Article >>> from django.contrib.auth.views import Site @@ -19,7 +28,6 @@ >>> a.save() >>> a.publications.add(p) >>> a.sites.add(current_site) ->>> a.save() >>> a = Article.objects.get(id=1) >>> a @@ -29,6 +37,19 @@ >>> a.sites.count() 1 -""" +# Regression for #12248 - Models can exist in the test package, too + +>>> ad = Advertisment(customer="Lawrence Journal-World") +>>> ad.save() +>>> ad.publications.add(p) + +>>> ad = Advertisment.objects.get(id=1) +>>> ad +<Advertisment: Advertisment object> + +>>> ad.publications.count() +1 + +"""} |
