Exemple #1
0
def clean_stuck(request, project_id):
    """Deletes task objects which are older than 24 hours."""
    one_day_ago = datetime.now() - timedelta(days=1)
    tasks = Task.objects.filter(project__id=project_id, user=request.user, issued_at__lte=one_day_ago)
    tasks_count = tasks.count()
    tasks.delete()
    set_notice(request, title="Cleaned", text="Deleted %s task(s)." % tasks_count)
    return redirect(request.META["HTTP_REFERER"], permanent=False)
Exemple #2
0
def clean_ready(request, project_id):
    """Deletes task objects which property 'ready' is True."""
    tasks = Task.objects.filter(project__id=project_id, user=request.user)
    finished_tasks = filter(attrgetter("ready"), tasks)
    finished_tasks = Task.objects.filter(id__in=(t.id for t in finished_tasks))
    finished_tasks_count = finished_tasks.count()
    finished_tasks.delete()
    set_notice(request, title='Cleaned', text='Deleted %s task(s).' % finished_tasks_count)
    return redirect(request.META["HTTP_REFERER"], permanent=False)
Exemple #3
0
def clean_ready(request, project_id):
    """Deletes task objects which property 'ready' is True."""
    tasks = Task.objects.filter(project__id=project_id, user=request.user)
    finished_tasks = filter(attrgetter("ready"), tasks)
    finished_tasks = Task.objects.filter(id__in=(t.id for t in finished_tasks))
    finished_tasks_count = finished_tasks.count()
    finished_tasks.delete()
    set_notice(request,
               title='Cleaned',
               text='Deleted %s task(s).' % finished_tasks_count)
    return redirect(request.META["HTTP_REFERER"], permanent=False)
Exemple #4
0
def clean_stuck(request, project_id):
    """Deletes task objects which are older than 24 hours."""
    one_day_ago = datetime.now() - timedelta(days=1)
    tasks = Task.objects.filter(project__id=project_id,
                                user=request.user,
                                issued_at__lte=one_day_ago)
    tasks_count = tasks.count()
    tasks.delete()
    set_notice(request,
               title="Cleaned",
               text="Deleted %s task(s)." % tasks_count)
    return redirect(request.META["HTTP_REFERER"], permanent=False)