COMPLETED = 'completed'
DELETED = 'deleted'
WAITING = 'waiting'
+RECURRING = 'recurring'
logger = logging.getLogger(__name__)
def delete(self):
if not self.saved:
- raise Task.NotSaved("Task needs to be saved before it can be deleted")
+ raise Task.NotSaved(
+ "Task needs to be saved before it can be deleted")
# Refresh the status, and raise exception if the task is deleted
self.refresh(only_fields=['status'])
def start(self):
if not self.saved:
- raise Task.NotSaved("Task needs to be saved before it can be started")
+ raise Task.NotSaved(
+ "Task needs to be saved before it can be started")
# Refresh, and raise exception if task is already completed/deleted
self.refresh(only_fields=['status'])
def stop(self):
if not self.saved:
- raise Task.NotSaved("Task needs to be saved before it can be stopped")
+ raise Task.NotSaved(
+ "Task needs to be saved before it can be stopped")
# Refresh, and raise exception if task is already completed/deleted
self.refresh(only_fields=['status'])
def done(self):
if not self.saved:
- raise Task.NotSaved("Task needs to be saved before it can be completed")
+ raise Task.NotSaved(
+ "Task needs to be saved before it can be completed")
# Refresh, and raise exception if task is already completed/deleted
self.refresh(only_fields=['status'])
def waiting(self):
return self.filter(status=WAITING)
+ def recurring(self):
+ return self.filter(status=RECURRING)
+
def filter(self, *args, **kwargs):
"""
Returns a new TaskQuerySet with the given filters added.