diff --git a/conservancy/usethesource/forms.py b/conservancy/usethesource/forms.py index 3f1277f0..22446458 100644 --- a/conservancy/usethesource/forms.py +++ b/conservancy/usethesource/forms.py @@ -8,7 +8,7 @@ class CommentForm(forms.ModelForm): class Meta: model = Comment - fields = ['time', 'message', 'post_to_list'] + fields = ['time', 'attribute_to', 'message', 'post_to_list'] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/conservancy/usethesource/migrations/0008_comment_attribute_to.py b/conservancy/usethesource/migrations/0008_comment_attribute_to.py new file mode 100644 index 00000000..d3ed69b1 --- /dev/null +++ b/conservancy/usethesource/migrations/0008_comment_attribute_to.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.19 on 2024-03-15 03:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('usethesource', '0007_candidate_show_download_disclaimer'), + ] + + operations = [ + migrations.AddField( + model_name='comment', + name='attribute_to', + field=models.CharField(blank=True, max_length=50), + ), + ] diff --git a/conservancy/usethesource/models.py b/conservancy/usethesource/models.py index 8de4e74a..6b070e54 100644 --- a/conservancy/usethesource/models.py +++ b/conservancy/usethesource/models.py @@ -41,6 +41,7 @@ class Comment(models.Model): candidate = models.ForeignKey(Candidate, on_delete=models.CASCADE) user = models.ForeignKey(User, on_delete=models.PROTECT) + attribute_to = models.CharField(max_length=50, blank=True) time = models.DateTimeField(default=timezone.now) message = models.TextField() email_message_id = models.CharField(max_length=255, default=gen_message_id) diff --git a/conservancy/usethesource/templates/usethesource/add_comment_form.html b/conservancy/usethesource/templates/usethesource/add_comment_form.html index 11e29666..a44729a5 100644 --- a/conservancy/usethesource/templates/usethesource/add_comment_form.html +++ b/conservancy/usethesource/templates/usethesource/add_comment_form.html @@ -1,6 +1,7 @@
{% csrf_token %} -
{{ form.time }}
+
+
{{ form.message }}
diff --git a/conservancy/usethesource/templates/usethesource/comment_partial.html b/conservancy/usethesource/templates/usethesource/comment_partial.html index 9716d5d2..c0af28d6 100644 --- a/conservancy/usethesource/templates/usethesource/comment_partial.html +++ b/conservancy/usethesource/templates/usethesource/comment_partial.html @@ -1,4 +1,4 @@ -
{{ comment.user }} — {{ comment.time }} +
{% if comment.attribute_to %}{{ comment.attribute_to }}{% else %}{{ comment.user }}{% endif %} — {{ comment.time }} {% if user.is_staff %} edit delete diff --git a/conservancy/usethesource/templates/usethesource/edit_comment_form.html b/conservancy/usethesource/templates/usethesource/edit_comment_form.html index 9eb52cf5..d8954500 100644 --- a/conservancy/usethesource/templates/usethesource/edit_comment_form.html +++ b/conservancy/usethesource/templates/usethesource/edit_comment_form.html @@ -1,6 +1,7 @@ {% csrf_token %} -
{{ form.time }}
+
+
{{ form.message }}