SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 29e5b68b authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Update Report to accept blank fields

parent c2e0bcb9
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-07-21 07:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('submissions', '0047_submission_acceptance_date'),
]
operations = [
migrations.AlterField(
model_name='report',
name='requested_changes',
field=models.TextField(blank=True, verbose_name='requested changes'),
),
migrations.AlterField(
model_name='report',
name='strengths',
field=models.TextField(blank=True),
),
migrations.AlterField(
model_name='report',
name='weaknesses',
field=models.TextField(blank=True),
),
]
......@@ -235,14 +235,26 @@ class RefereeInvitation(models.Model):
###########
class Report(models.Model):
""" Both types of reports, invited or contributed. """
"""
Both types of reports, invited or contributed.
This Report model acts as both a regular `Report` and a `FollowupReport`; A normal Report
should have all fields required, whereas a FollowupReport only has the `report` field as
a required field.
Important note!
Due to the construction of the two different types within a single model, it is important
to explicitly implement the perticular differences in for example the form used.
"""
status = models.CharField(max_length=16, choices=REPORT_STATUSES, default=STATUS_UNVETTED)
submission = models.ForeignKey('submissions.Submission', related_name='reports',
on_delete=models.CASCADE)
vetted_by = models.ForeignKey('scipost.Contributor', related_name="report_vetted_by",
blank=True, null=True, on_delete=models.CASCADE)
# `invited' filled from RefereeInvitation objects at moment of report submission
invited = models.BooleanField(default=False)
# `flagged' if author of report has been flagged by submission authors (surname check only)
flagged = models.BooleanField(default=False)
date_submitted = models.DateTimeField('date submitted')
......@@ -250,11 +262,13 @@ class Report(models.Model):
qualification = models.PositiveSmallIntegerField(
choices=REFEREE_QUALIFICATION,
verbose_name="Qualification to referee this: I am ")
# Text-based reporting
strengths = models.TextField()
weaknesses = models.TextField()
strengths = models.TextField(blank=True)
weaknesses = models.TextField(blank=True)
report = models.TextField()
requested_changes = models.TextField(verbose_name="requested changes")
requested_changes = models.TextField(verbose_name="requested changes", blank=True)
# Qualities:
validity = models.PositiveSmallIntegerField(choices=RANKING_CHOICES, default=101)
significance = models.PositiveSmallIntegerField(choices=RANKING_CHOICES, default=101)
......@@ -276,6 +290,13 @@ class Report(models.Model):
return (self.author.user.first_name + ' ' + self.author.user.last_name + ' on ' +
self.submission.title[:50] + ' by ' + self.submission.author_list[:50])
def is_followup_report(self, kip=None):
"""
Check if current Report is a `FollowupReport`. A Report is a `FollowupReport` if the
author of the report already has a vetted report in the series of the specific Submission.
"""
return self.author.report_set.accepted().filter(submission=self.submission).exists()
##########################
# EditorialCommunication #
......
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