mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #12168 -- Corrected the registration of m2m autocreated models when models.py is split into submodules. Thanks to Jens Diemer for the report and test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11724 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
77abadfa6a
commit
7b63d3d3b4
6 changed files with 65 additions and 1 deletions
34
tests/modeltests/model_package/tests.py
Normal file
34
tests/modeltests/model_package/tests.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
"""
|
||||
>>> from models.publication import Publication
|
||||
>>> from models.article import Article
|
||||
>>> from django.contrib.auth.views import Site
|
||||
|
||||
>>> p = Publication(title="FooBar")
|
||||
>>> p.save()
|
||||
>>> p
|
||||
<Publication: Publication object>
|
||||
|
||||
>>> from django.contrib.sites.models import Site
|
||||
>>> current_site = Site.objects.get_current()
|
||||
>>> current_site
|
||||
<Site: example.com>
|
||||
|
||||
# Regression for #12168: models split into subpackages still get M2M tables
|
||||
|
||||
>>> a = Article(headline="a foo headline")
|
||||
>>> a.save()
|
||||
>>> a.publications.add(p)
|
||||
>>> a.sites.add(current_site)
|
||||
>>> a.save()
|
||||
|
||||
>>> a = Article.objects.get(id=1)
|
||||
>>> a
|
||||
<Article: Article object>
|
||||
>>> a.id
|
||||
1
|
||||
>>> a.sites.count()
|
||||
1
|
||||
|
||||
"""
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue