Skip to content

Commit 58f204f

Browse files
author
Your Name
committed
task count
1 parent ec67717 commit 58f204f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

tasks/templates/index.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,34 @@
1414
<div class="">
1515

1616
<h3>Projects</h3>
17+
<small>
18+
<a target='_blank' href="/admin">admin</a>
19+
</small>
1720
<hr>
1821

1922
<ul class="">
2023
{%for p in projects %}
2124
{% if p.tasks.count > 0 %}
2225

2326
<li>
24-
<a href="?p={{p.id}}">
27+
<a href="?id={{p.id}}">
2528
{{p.name}}
2629
</a>
2730
</li>
2831
{% endif %}
2932
{% endfor %}
3033
</ul>
3134
</div>
32-
</div>
35+
</div>
36+
{% if tasks_count %}
3337
<div class="column is-10">
3438
<div id="gantt" ></div>
3539
<button class="button" onclick="change(this)">Day</button>
3640
<button class="button" onclick="change(this)">Week</button>
3741
<button class="button" onclick="change(this)">Month</button>
3842

3943
</div>
44+
{% endif %}
4045
</div>
4146
</div>
4247
</section>

tasks/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ def process(self, t):
2020
def get_context_data(self, **kwargs):
2121
ctx = super(TaskView, self).get_context_data(**kwargs)
2222
id = self.request.GET.get("id",None)
23+
2324
if not id:
24-
tasks = Task.objects.all()
25+
tasks = Task.objects.none()
2526
else:
2627
tasks = Task.objects.filter(project__id=id)
28+
2729
ctx["projects"] = Project.objects.all()
30+
ctx["tasks_count"] = tasks.count()
2831
ctx["tasks"] = json.dumps([ self.process(t) for t in tasks])
2932
return ctx
3033

0 commit comments

Comments
 (0)