diff options
| author | Honza Král <honza.kral@gmail.com> | 2010-10-18 05:02:28 +0000 |
|---|---|---|
| committer | Honza Král <honza.kral@gmail.com> | 2010-10-18 05:02:28 +0000 |
| commit | efcb7776a0209447cc8ac3eb12760c197eeed7bb (patch) | |
| tree | 00d6ce76b93eb1515776908c763b53cc3cd8da1e /tests/regressiontests/sites_framework/models.py | |
| parent | 55d8c47d29ce24428fbfd425a5ae6030bbeaf09f (diff) | |
[1.2.X] Fixed #13790 -- auto detection of m2m fields to Site. Thanks, gabrielhurley!
Backport from trunk (r14251).
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14252 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/sites_framework/models.py')
| -rw-r--r-- | tests/regressiontests/sites_framework/models.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/regressiontests/sites_framework/models.py b/tests/regressiontests/sites_framework/models.py new file mode 100644 index 0000000000..9ecc3e6660 --- /dev/null +++ b/tests/regressiontests/sites_framework/models.py @@ -0,0 +1,36 @@ +from django.contrib.sites.managers import CurrentSiteManager +from django.contrib.sites.models import Site +from django.db import models + +class AbstractArticle(models.Model): + title = models.CharField(max_length=50) + + objects = models.Manager() + on_site = CurrentSiteManager() + + class Meta: + abstract = True + + def __unicode__(self): + return self.title + +class SyndicatedArticle(AbstractArticle): + sites = models.ManyToManyField(Site) + +class ExclusiveArticle(AbstractArticle): + site = models.ForeignKey(Site) + +class CustomArticle(AbstractArticle): + places_this_article_should_appear = models.ForeignKey(Site) + + objects = models.Manager() + on_site = CurrentSiteManager("places_this_article_should_appear") + +class InvalidArticle(AbstractArticle): + site = models.ForeignKey(Site) + + objects = models.Manager() + on_site = CurrentSiteManager("places_this_article_should_appear") + +class ConfusedArticle(AbstractArticle): + site = models.IntegerField() |
