From: Cezary Czaplewski Date: Mon, 8 Jan 2018 19:35:32 +0000 (+0100) Subject: autorefresh index and details (login user) X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=commitdiff_plain;h=32eab17b5d32751f900c80ffc18e6661bfe90572;p=django_unres.git autorefresh index and details (login user) --- diff --git a/django_simple/todo/templates/details.html b/django_simple/todo/templates/details.html index f8439bd..4cb9bd7 100644 --- a/django_simple/todo/templates/details.html +++ b/django_simple/todo/templates/details.html @@ -633,6 +633,29 @@ function showDivs(n) { x[slideIndex-1].style.display = "block"; } + +{% if not task.done %} + +{% endif %} {% endblock %} diff --git a/django_simple/todo/templates/index.html b/django_simple/todo/templates/index.html index 1aa90da..33bbd55 100644 --- a/django_simple/todo/templates/index.html +++ b/django_simple/todo/templates/index.html @@ -78,5 +78,29 @@ {% endfor %} +{% if not alldone %} + -{% endblock %} \ No newline at end of file + +{% endif %} + +{% endblock %} diff --git a/django_simple/todo/views.py b/django_simple/todo/views.py index 1c7434c..a29ae69 100644 --- a/django_simple/todo/views.py +++ b/django_simple/todo/views.py @@ -110,7 +110,7 @@ def index(request): tasks = Task.objects.filter(owner=user).order_by('-created_date') variable = '' return render(request, "index.html", { - 'tasks': tasks + 'tasks': tasks, 'alldone': 0 }) @login_required @@ -608,8 +608,11 @@ def refresh_done1(request, task_id): def refresh_done(request): user = request.user tasks = Task.objects.filter(owner=user).order_by('-created_date') + alldone = 1 for task in tasks: refresh_done0(task) + if not task.done: + alldone=0 proc = subprocess.Popen('/opt/torque/bin/qstat', stdout=subprocess.PIPE) njob=0 @@ -627,7 +630,8 @@ def refresh_done(request): else: return render(request, "index.html", { 'tasks': tasks , - 'variable' : variable + 'variable' : variable, + 'alldone': alldone })