diff --git a/src/teams/migrations/0043_auto_20180804_1641.py b/src/teams/migrations/0043_auto_20180804_1641.py
new file mode 100644
index 00000000..e2460dc1
--- /dev/null
+++ b/src/teams/migrations/0043_auto_20180804_1641.py
@@ -0,0 +1,24 @@
+# Generated by Django 2.0.4 on 2018-08-04 14:41
+
+import django.contrib.postgres.fields.ranges
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('teams', '0042_auto_20180413_1933'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='teamtask',
+ name='completed',
+ field=models.BooleanField(default=False, help_text='Check to mark this task as completed.'),
+ ),
+ migrations.AddField(
+ model_name='teamtask',
+ name='when',
+ field=django.contrib.postgres.fields.ranges.DateTimeRangeField(blank=True, help_text='When does this task need to be started and/or finished?', null=True),
+ ),
+ ]
diff --git a/src/teams/models.py b/src/teams/models.py
index b145c44b..e51320b5 100644
--- a/src/teams/models.py
+++ b/src/teams/models.py
@@ -4,6 +4,7 @@ from django.dispatch import receiver
from django.utils.text import slugify
from utils.models import CampRelatedModel
from django.core.exceptions import ValidationError
+from django.contrib.postgres.fields import DateTimeRangeField
from django.contrib.auth.models import User
from django.urls import reverse_lazy
from django.conf import settings
@@ -280,6 +281,15 @@ class TeamTask(CampRelatedModel):
description = models.TextField(
help_text='Description of the task. Markdown is supported.'
)
+ when = DateTimeRangeField(
+ blank=True,
+ null=True,
+ help_text='When does this task need to be started and/or finished?'
+ )
+ completed = models.BooleanField(
+ help_text='Check to mark this task as completed.',
+ default=False
+ )
class Meta:
ordering = ['name']
diff --git a/src/teams/templates/includes/team_tasks.html b/src/teams/templates/includes/team_tasks.html
new file mode 100644
index 00000000..f285eef4
--- /dev/null
+++ b/src/teams/templates/includes/team_tasks.html
@@ -0,0 +1,44 @@
+
+
+
Tasks
+
+
+
The {{ team.name }} Team is responsible for the following tasks
+
+
+
+ Name |
+ Description |
+ When |
+ Completed |
+ Action |
+
+
+
+ {% for task in team.tasks.all %}
+
+ {{ task.name }} |
+ {{ task.description }} |
+
+
+ - Start: {{ task.when.lower|default:"N/A" }}
+ - Finish: {{ task.when.upper|default:"N/A" }}
+
+ |
+ {{ task.completed }} |
+
+ Details
+ {% if request.user in team.responsible_members.all %}
+ Edit Task
+ {% endif %}
+ |
+
+ {% endfor %}
+
+
+ {% if request.user in team.responsible_members.all %}
+
Create Task
+ {% endif %}
+
+
+
diff --git a/src/teams/templates/task_detail.html b/src/teams/templates/task_detail.html
index 69525bbe..d919d3d0 100644
--- a/src/teams/templates/task_detail.html
+++ b/src/teams/templates/task_detail.html
@@ -7,8 +7,15 @@
{% block content %}
-
Task: {{ task.name }}
-
{{ task.description|untrustedcommonmark }}
+
Task: {{ task.name }} ({% if not task.completed %}Not {% endif %}Completed)
+
+ {{ task.description|untrustedcommonmark }}
+
+
+ - Start: {{ task.when.lower|default:"N/A" }}
+ - Finish: {{ task.when.upper|default:"N/A" }}
+
+
diff --git a/src/teams/templates/team_detail.html b/src/teams/templates/team_detail.html
index 8c7c4096..2caa8544 100644
--- a/src/teams/templates/team_detail.html
+++ b/src/teams/templates/team_detail.html
@@ -53,41 +53,7 @@ Team: {{ team.name }} | {{ block.super }}
-{# Team tasks #}
-
-
-
Tasks
-
-
-
The {{ team.name }} Team is responsible for the following tasks
-
-
-
- Name |
- Description |
- Action |
-
-
-
- {% for task in team.tasks.all %}
-
- {{ task.name }} |
- {{ task.description }} |
-
- Details
- {% if request.user in team.responsible_members.all %}
- Edit Task
- {% endif %}
- |
-
- {% endfor %}
-
-
- {% if request.user in team.responsible_members.all %}
-
Create Task
- {% endif %}
-
-
+{% include 'includes/team_tasks.html' %}
{# Team members #}
diff --git a/src/teams/templates/team_manage.html b/src/teams/templates/team_manage.html
index a1635c26..5e9b701b 100644
--- a/src/teams/templates/team_manage.html
+++ b/src/teams/templates/team_manage.html
@@ -94,5 +94,9 @@ Manage Team: {{ team.name }} | {{ block.super }}
{% endif %}
+
+{% include 'includes/team_tasks.html' %}
+
{% endblock %}
+
diff --git a/src/teams/views/tasks.py b/src/teams/views/tasks.py
index 5e661df0..ebd61398 100644
--- a/src/teams/views/tasks.py
+++ b/src/teams/views/tasks.py
@@ -16,7 +16,7 @@ class TaskDetailView(CampViewMixin, DetailView):
class TaskCreateView(LoginRequiredMixin, CampViewMixin, EnsureTeamResponsibleMixin, CreateView):
model = TeamTask
template_name = "task_form.html"
- fields = ['name', 'description']
+ fields = ['name', 'description', 'when', 'completed']
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(**kwargs)
@@ -38,7 +38,7 @@ class TaskCreateView(LoginRequiredMixin, CampViewMixin, EnsureTeamResponsibleMix
class TaskUpdateView(LoginRequiredMixin, CampViewMixin, EnsureTeamResponsibleMixin, UpdateView):
model = TeamTask
template_name = "task_form.html"
- fields = ['name', 'description']
+ fields = ['name', 'description', 'when', 'completed']
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(**kwargs)
@@ -54,4 +54,4 @@ class TaskUpdateView(LoginRequiredMixin, CampViewMixin, EnsureTeamResponsibleMix
return HttpResponseRedirect(task.get_absolute_url())
def get_success_url(self):
- return self.get_object().get_absolute_url()
\ No newline at end of file
+ return self.get_object().get_absolute_url()