SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit cc703cff authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Comments: add vetted_by field and correction category

parent 725fa5cf
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ comment_refusal_dict = dict(COMMENT_REFUSAL_CHOICES) ...@@ -24,7 +24,7 @@ comment_refusal_dict = dict(COMMENT_REFUSAL_CHOICES)
class CommentForm(forms.ModelForm): class CommentForm(forms.ModelForm):
class Meta: class Meta:
model = Comment 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): def __init__(self, *args, **kwargs):
super(CommentForm, self).__init__(*args, **kwargs) super(CommentForm, self).__init__(*args, **kwargs)
...@@ -42,7 +42,7 @@ class CommentForm(forms.ModelForm): ...@@ -42,7 +42,7 @@ class CommentForm(forms.ModelForm):
Div( Div(
Fieldset( Fieldset(
'Specify categorization(s):', '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%"), style="border: 0px; font-size: 90%"),
HTML('<br>'), HTML('<br>'),
Div( Div(
......
...@@ -39,6 +39,7 @@ class Comment(models.Model): ...@@ -39,6 +39,7 @@ class Comment(models.Model):
# -2: rejected (incorrect) # -2: rejected (incorrect)
# -3: rejected (not useful) # -3: rejected (not useful)
status = models.SmallIntegerField(default=0) 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 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) submission = models.ForeignKey(Submission, blank=True, null=True)
thesislink = models.ForeignKey(ThesisLink, blank=True, null=True) thesislink = models.ForeignKey(ThesisLink, blank=True, null=True)
...@@ -53,6 +54,7 @@ class Comment(models.Model): ...@@ -53,6 +54,7 @@ class Comment(models.Model):
is_ans = models.BooleanField(default=False, verbose_name='answer to question') is_ans = models.BooleanField(default=False, verbose_name='answer to question')
is_obj = models.BooleanField(default=False, verbose_name='objection') is_obj = models.BooleanField(default=False, verbose_name='objection')
is_rep = models.BooleanField(default=False, verbose_name='reply to 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_val = models.BooleanField(default=False, verbose_name='validation or rederivation')
is_lit = models.BooleanField(default=False, verbose_name='pointer to related literature') is_lit = models.BooleanField(default=False, verbose_name='pointer to related literature')
is_sug = models.BooleanField(default=False, verbose_name='suggestion for further work') is_sug = models.BooleanField(default=False, verbose_name='suggestion for further work')
...@@ -212,6 +214,8 @@ class Comment(models.Model): ...@@ -212,6 +214,8 @@ class Comment(models.Model):
output += '<li>objection</li>' output += '<li>objection</li>'
if self.is_rep: if self.is_rep:
output += '<li>reply to objection</li>' output += '<li>reply to objection</li>'
if self.is_cor:
output += '<li>correction</li>'
if self.is_val: if self.is_val:
output += '<li>validation or rederivation</li>' output += '<li>validation or rederivation</li>'
if self.is_lit: if self.is_lit:
......
...@@ -32,6 +32,7 @@ def vet_submitted_comment_ack(request, comment_id): ...@@ -32,6 +32,7 @@ def vet_submitted_comment_ack(request, comment_id):
if form.cleaned_data['action_option'] == '1': if form.cleaned_data['action_option'] == '1':
# accept the comment as is # accept the comment as is
comment.status = 1 comment.status = 1
comment.vetted_by = request.user.contributor
comment.save() comment.save()
email_text = ('Dear ' + title_dict[comment.author.title] + ' ' + comment.author.user.last_name + email_text = ('Dear ' + title_dict[comment.author.title] + ' ' + comment.author.user.last_name +
', \n\nThe Comment you have submitted, concerning publication with title ') ', \n\nThe Comment you have submitted, concerning publication with title ')
...@@ -112,6 +113,7 @@ def reply_to_comment(request, comment_id): ...@@ -112,6 +113,7 @@ def reply_to_comment(request, comment_id):
is_ans = form.cleaned_data['is_ans'], is_ans = form.cleaned_data['is_ans'],
is_obj = form.cleaned_data['is_obj'], is_obj = form.cleaned_data['is_obj'],
is_rep = form.cleaned_data['is_rep'], is_rep = form.cleaned_data['is_rep'],
is_cor = form.cleaned_data['is_cor'],
is_val = form.cleaned_data['is_val'], is_val = form.cleaned_data['is_val'],
is_lit = form.cleaned_data['is_lit'], is_lit = form.cleaned_data['is_lit'],
is_sug = form.cleaned_data['is_sug'], is_sug = form.cleaned_data['is_sug'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment