def sa_schedule_model(sa_schedule_abc, sa_declarative_base, persister): return sa.create_schedule(sa_schedule_abc, sa_declarative_base, persister=persister)
class ScheduleABC(create_schedule_abc(User)): def __init__(self, name='', *args, **kwargs): self.name = name super().__init__(*args, **kwargs) def __str__(self): return '{}\'s schedule {} {}'.format( self.owner.fullname if self.owner else 'Anonymous', self.name, self.url) name = Column(Text, nullable=False, default='') @property def serialized(self): schema = ScheduleSchema() return schema.dump(self).data @property def state(self): return self.get_state(celery) Schedule = create_schedule(ScheduleABC, db.Model, persister=persister) class ScheduleSchema(get_base_schema(Schedule, json_field='dict')): state = fields.Method('get_state') def get_state(self, schedule): return schedule.get_state(celery)