diff --git a/src/teams/migrations/0047_taskcomment.py b/src/teams/migrations/0047_taskcomment.py new file mode 100644 index 00000000..3dc0eada --- /dev/null +++ b/src/teams/migrations/0047_taskcomment.py @@ -0,0 +1,29 @@ +# Generated by Django 2.1 on 2018-08-14 17:42 + +from django.db import migrations, models +import django.db.models.deletion +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('teams', '0046_auto_20180808_2154'), + ] + + operations = [ + migrations.CreateModel( + name='TaskComment', + fields=[ + ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('created', models.DateTimeField(auto_now_add=True)), + ('updated', models.DateTimeField(auto_now=True)), + ('content', models.TextField()), + ('author', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='teams.TeamMember')), + ('task', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='comments', to='teams.TeamTask')), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/src/teams/migrations/0048_auto_20180814_1950.py b/src/teams/migrations/0048_auto_20180814_1950.py new file mode 100644 index 00000000..c59f9f8c --- /dev/null +++ b/src/teams/migrations/0048_auto_20180814_1950.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1 on 2018-08-14 17:50 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('teams', '0047_taskcomment'), + ] + + operations = [ + migrations.RenameField( + model_name='taskcomment', + old_name='content', + new_name='comment', + ), + ] diff --git a/src/teams/models.py b/src/teams/models.py index f78aba71..f0664dc2 100644 --- a/src/teams/models.py +++ b/src/teams/models.py @@ -9,7 +9,7 @@ from django.urls import reverse_lazy from django.conf import settings from django.contrib.postgres.fields import DateTimeRangeField -from utils.models import CampRelatedModel +from utils.models import CampRelatedModel, CreatedUpdatedModel, UUIDModel logger = logging.getLogger("bornhack.%s" % __name__) @@ -320,6 +320,12 @@ class TeamTask(CampRelatedModel): super().save(**kwargs) +class TaskComment(UUIDModel, CreatedUpdatedModel): + task = models.ForeignKey('teams.TeamTask', on_delete=models.PROTECT, related_name="comments") + author = models.ForeignKey('teams.TeamMember', on_delete=models.PROTECT) + comment = models.TextField() + + class TeamShift(CampRelatedModel): class Meta: diff --git a/src/teams/templates/task_detail.html b/src/teams/templates/task_detail.html index 6e346877..c650ebb3 100644 --- a/src/teams/templates/task_detail.html +++ b/src/teams/templates/task_detail.html @@ -1,5 +1,6 @@ {% extends 'team_base.html' %} {% load commonmark %} +{% load bootstrap3 %} {% block title %} {{ task.name }} @@ -16,7 +17,31 @@