2008-07-21 23:41:21 +08:00
|
|
|
from django.db import models
|
|
|
|
|
2011-10-14 05:34:56 +08:00
|
|
|
|
2008-07-21 23:41:21 +08:00
|
|
|
class SourceManager(models.Manager):
|
|
|
|
def get_query_set(self):
|
|
|
|
return super(SourceManager, self).get_query_set().filter(is_public=True)
|
|
|
|
|
|
|
|
class Source(models.Model):
|
|
|
|
is_public = models.BooleanField()
|
|
|
|
objects = SourceManager()
|
|
|
|
|
|
|
|
class Item(models.Model):
|
|
|
|
source = models.ForeignKey(Source)
|