def repeat_task(date, command, interval): if interval < 30: raise ValueError('No repeats shorter than 30 seconds') t = ScheduledTasks() t.date = date t.command = command t.repeat = True t.repeat_interval = interval
def schedule_task(date, command): t = ScheduledTasks() t.date = date t.command = command t.repeat = False t.save()