123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- from datetime import datetime
- from django.db import models
- from django.conf import settings
- class StoryManager(models.Manager):
- def published(self):
- return self.filter(
- sites=settings.SITE_ID, published=True, published_on__lte=datetime.now
- )
- def leads(self):
- return self.filter(published=True, lead=True, published_on__lte=datetime.now)
- def nonleads(self):
- return self.filter(published=True, lead=False, published_on__lte=datetime.now)
- def drafts(self):
- return self.filter(sites=settings.SITE_ID, published=False)
- class EditorialManager(models.Manager):
- def published(self):
- return self.filter(
- sites=settings.SITE_ID, published=True, published_on__lte=datetime.now
- )
- def drafts(self):
- return self.filter(sites=settings.SITE_ID, published=False)
- class EditionManager(models.Manager):
- def published(self):
- return self.filter(
- site=settings.SITE_ID, published=True, published_on__lte=datetime.now
- )
- class LeadStoryManager(models.Manager):
- def get_query_set(self):
- return (
- super(LeadStoryManager, self)
- .get_query_set()
- .filter(lead=True, published=True)
- )
- class PatriotEditionManager(models.Manager):
- def get_query_set(self):
- return (
- super(PatriotEditionManager, self)
- .get_query_set()
- .filter(paper__name="Castine Patriot", published=True)
- )
- class AdvantagesEditionManager(models.Manager):
- def get_query_set(self):
- return (
- super(AdvantagesEditionManager, self)
- .get_query_set()
- .filter(paper__name="Island Ad-Vantages", published=True)
- )
- class PacketEditionManager(models.Manager):
- def get_query_set(self):
- return (
- super(PacketEditionManager, self)
- .get_query_set()
- .filter(paper__name="Weekly Packet", published=True)
- )
- class CompassEditionManager(models.Manager):
- def get_query_set(self):
- return (
- super(CompassEditionManager, self)
- .get_query_set()
- .filter(paper__name="Compass", published=True)
- )
|