From cc703cff643c3c4d3811e2d90cf7eb129b6bad16 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Sat, 2 Apr 2016 17:26:38 +0200 Subject: [PATCH] Comments: add vetted_by field and correction category --- comments/forms.py | 4 ++-- comments/models.py | 4 ++++ comments/views.py | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/comments/forms.py b/comments/forms.py index 13f3b75b0..57f0eb191 100644 --- a/comments/forms.py +++ b/comments/forms.py @@ -24,7 +24,7 @@ comment_refusal_dict = dict(COMMENT_REFUSAL_CHOICES) class CommentForm(forms.ModelForm): class Meta: model = Comment - fields = ['is_rem', 'is_que', 'is_ans', 'is_obj', 'is_rep', 'is_val', 'is_lit', 'is_sug', 'comment_text', 'remarks_for_editors'] + fields = ['is_rem', 'is_que', 'is_ans', 'is_obj', 'is_rep', 'is_cor', 'is_val', 'is_lit', 'is_sug', 'comment_text', 'remarks_for_editors'] def __init__(self, *args, **kwargs): super(CommentForm, self).__init__(*args, **kwargs) @@ -42,7 +42,7 @@ class CommentForm(forms.ModelForm): Div( Fieldset( 'Specify categorization(s):', - 'is_rem', 'is_que', 'is_ans', 'is_obj', 'is_rep', 'is_val', 'is_lit', 'is_sug', + 'is_rem', 'is_que', 'is_ans', 'is_obj', 'is_rep', 'is_cor', 'is_val', 'is_lit', 'is_sug', style="border: 0px; font-size: 90%"), HTML('<br>'), Div( diff --git a/comments/models.py b/comments/models.py index da6575a27..658be03af 100644 --- a/comments/models.py +++ b/comments/models.py @@ -39,6 +39,7 @@ class Comment(models.Model): # -2: rejected (incorrect) # -3: rejected (not useful) status = models.SmallIntegerField(default=0) + vetted_by = models.ForeignKey(Contributor, blank=True, null=True, related_name='comment_vetted_by') commentary = models.ForeignKey(Commentary, blank=True, null=True) # a Comment is either for a Commentary or Submission submission = models.ForeignKey(Submission, blank=True, null=True) thesislink = models.ForeignKey(ThesisLink, blank=True, null=True) @@ -53,6 +54,7 @@ class Comment(models.Model): is_ans = models.BooleanField(default=False, verbose_name='answer to question') is_obj = models.BooleanField(default=False, verbose_name='objection') is_rep = models.BooleanField(default=False, verbose_name='reply to objection') + is_cor = models.BooleanField(default=False, verbose_name='correction') is_val = models.BooleanField(default=False, verbose_name='validation or rederivation') is_lit = models.BooleanField(default=False, verbose_name='pointer to related literature') is_sug = models.BooleanField(default=False, verbose_name='suggestion for further work') @@ -212,6 +214,8 @@ class Comment(models.Model): output += '<li>objection</li>' if self.is_rep: output += '<li>reply to objection</li>' + if self.is_cor: + output += '<li>correction</li>' if self.is_val: output += '<li>validation or rederivation</li>' if self.is_lit: diff --git a/comments/views.py b/comments/views.py index 071fb19d8..4b3771efc 100644 --- a/comments/views.py +++ b/comments/views.py @@ -32,6 +32,7 @@ def vet_submitted_comment_ack(request, comment_id): if form.cleaned_data['action_option'] == '1': # accept the comment as is comment.status = 1 + comment.vetted_by = request.user.contributor comment.save() email_text = ('Dear ' + title_dict[comment.author.title] + ' ' + comment.author.user.last_name + ', \n\nThe Comment you have submitted, concerning publication with title ') @@ -112,6 +113,7 @@ def reply_to_comment(request, comment_id): is_ans = form.cleaned_data['is_ans'], is_obj = form.cleaned_data['is_obj'], is_rep = form.cleaned_data['is_rep'], + is_cor = form.cleaned_data['is_cor'], is_val = form.cleaned_data['is_val'], is_lit = form.cleaned_data['is_lit'], is_sug = form.cleaned_data['is_sug'], -- GitLab