def kwargs(self, site, page): kwargs = { 'page': page, 'site': site } page = page or '/visits' if page == 'last': kwargs['visits'] = ( self.db.query(Visit) .filter(on(site)) .order_by(Visit.date.desc())[:10]) kwargs['kwargs'] = kwargs return kwargs
def filter(self, query): return (query .filter(on(self.site, self.table)) .filter(between(self.from_date, self.to_date, self.table)) .filter(self.get_restrict()))