PageRenderTime 161ms CodeModel.GetById 80ms app.highlight 3ms RepoModel.GetById 58ms app.codeStats 0ms

/tests/regressiontests/sites_framework/models.py

https://code.google.com/p/mango-py/
Python | 36 lines | 25 code | 11 blank | 0 comment | 0 complexity | e741fa6c63a6fb32eac50e931fefc250 MD5 | raw file
 1from django.contrib.sites.managers import CurrentSiteManager
 2from django.contrib.sites.models import Site
 3from django.db import models
 4
 5class AbstractArticle(models.Model):
 6    title = models.CharField(max_length=50)
 7
 8    objects = models.Manager()
 9    on_site = CurrentSiteManager()
10
11    class Meta:
12        abstract = True
13
14    def __unicode__(self):
15        return self.title
16
17class SyndicatedArticle(AbstractArticle):
18    sites = models.ManyToManyField(Site)
19
20class ExclusiveArticle(AbstractArticle):
21    site = models.ForeignKey(Site)
22
23class CustomArticle(AbstractArticle):
24    places_this_article_should_appear = models.ForeignKey(Site)
25
26    objects = models.Manager()
27    on_site = CurrentSiteManager("places_this_article_should_appear")
28
29class InvalidArticle(AbstractArticle):
30    site = models.ForeignKey(Site)
31
32    objects = models.Manager()
33    on_site = CurrentSiteManager("places_this_article_should_appear")
34
35class ConfusedArticle(AbstractArticle):
36    site = models.IntegerField()