diff --git a/conservancy/usethesource/forms.py b/conservancy/usethesource/forms.py index 3f1277f060987b5d07594542645ff11b07d70da2..22446458871d010b521e93efac98d077dae1b711 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 0000000000000000000000000000000000000000..d3ed69b18f06a4b184a2414ca743c2e635e8aba1 --- /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 8de4e74ab5a9cc1b92f5ec8ca65354cb385d824a..6b070e5443674e96c11d27e581ac69f51a4affc3 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 11e296662adce4baea11c13931fa72167763eb00..a44729a5e35446e8398769284a68a505adf3acfa 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 9716d5d2f54ad3c1edd365d54b12480472d38dbd..c0af28d60d86658dff16752cc4c7cd30035712ea 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 9eb52cf5576a4bc86625dfaea446a12a193cc46b..d8954500b3a20cb46f7b647c16dd7c7e5736ba16 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 }}