SciPost Code Repository

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

Alter default_related_name for Report

parent d83a328a
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 09:00
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('submissions', '0052_auto_20170721_1057'),
]
operations = [
migrations.AlterField(
model_name='report',
name='author',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reports', to='scipost.Contributor'),
),
]
...@@ -248,8 +248,7 @@ class Report(models.Model): ...@@ -248,8 +248,7 @@ class Report(models.Model):
to explicitly implement the perticular differences in for example the form used. to explicitly implement the perticular differences in for example the form used.
""" """
status = models.CharField(max_length=16, choices=REPORT_STATUSES, default=STATUS_UNVETTED) status = models.CharField(max_length=16, choices=REPORT_STATUSES, default=STATUS_UNVETTED)
submission = models.ForeignKey('submissions.Submission', related_name='reports', submission = models.ForeignKey('submissions.Submission', on_delete=models.CASCADE)
on_delete=models.CASCADE)
vetted_by = models.ForeignKey('scipost.Contributor', related_name="report_vetted_by", vetted_by = models.ForeignKey('scipost.Contributor', related_name="report_vetted_by",
blank=True, null=True, on_delete=models.CASCADE) blank=True, null=True, on_delete=models.CASCADE)
...@@ -291,6 +290,9 @@ class Report(models.Model): ...@@ -291,6 +290,9 @@ class Report(models.Model):
objects = ReportManager() objects = ReportManager()
class Meta:
default_related_name = 'reports'
def __str__(self): def __str__(self):
return (self.author.user.first_name + ' ' + self.author.user.last_name + ' on ' + return (self.author.user.first_name + ' ' + self.author.user.last_name + ' on ' +
self.submission.title[:50] + ' by ' + self.submission.author_list[:50]) self.submission.title[:50] + ' by ' + self.submission.author_list[:50])
...@@ -301,7 +303,7 @@ class Report(models.Model): ...@@ -301,7 +303,7 @@ class Report(models.Model):
Check if current Report is a `FollowupReport`. A Report is a `FollowupReport` if the 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. author of the report already has a vetted report in the series of the specific Submission.
""" """
return (self.author.report_set.accepted() return (self.author.reports.accepted()
.filter(submission__arxiv_identifier_wo_vn_nr=self.submission.arxiv_identifier_wo_vn_nr) .filter(submission__arxiv_identifier_wo_vn_nr=self.submission.arxiv_identifier_wo_vn_nr)
.exists()) .exists())
...@@ -309,7 +311,7 @@ class Report(models.Model): ...@@ -309,7 +311,7 @@ class Report(models.Model):
""" """
Get latest Report from the same author for the Submission series. Get latest Report from the same author for the Submission series.
""" """
return (self.author.report_set.accepted() return (self.author.reports.accepted()
.filter(submission__arxiv_identifier_wo_vn_nr=self.submission.arxiv_identifier_wo_vn_nr) .filter(submission__arxiv_identifier_wo_vn_nr=self.submission.arxiv_identifier_wo_vn_nr)
.order_by('submission__arxiv_identifier_wo_vn_nr').last()) .order_by('submission__arxiv_identifier_wo_vn_nr').last())
......
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