def hidden(self): """Return a query for not yet published articles. To hide an article set :attr:`Article.public` to `False` or set :attr:`Article.pub_date` to some value in the future. """ q = self.filter( db.or_(Article.public == False, Article.pub_date > datetime.utcnow())) return q
def hidden(self): """Return a query for not yet published articles. To hide an article set :attr:`Article.public` to `False` or set :attr:`Article.pub_date` to some value in the future. """ q = self.filter(db.or_( Article.public == False, Article.pub_date > datetime.utcnow() )) return q
def during(self, begin, end): """Return a query for all events that overlap either the beginning, the end or both :param begin: the beginning of the timeframe :param end: the end of the timeframe """ q = self.filter( db.or_(db.and_(Event.start_date >= begin, Event.start_date <= end), db.and_(Event.end_date >= begin, Event.end_date <= end))).order_by(Event.start_date) return q
def during(self, begin, end): """Return a query for all events that overlap either the beginning, the end or both :param begin: the beginning of the timeframe :param end: the end of the timeframe """ q = self.filter(db.or_( db.and_( Event.start_date >= begin, Event.start_date <= end ), db.and_( Event.end_date >= begin, Event.end_date <= end ) )).order_by(Event.start_date) return q