From a7e8ef82accdcec31b80142b09a516b74e177efe Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Mon, 24 Jul 2017 17:07:07 +0200 Subject: [PATCH] Remove ArxivCallable mixin --- commentaries/models.py | 8 ++------ scipost/behaviors.py | 10 ---------- scipost/services.py | 6 ------ submissions/models.py | 16 ++++++++++++++-- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/commentaries/models.py b/commentaries/models.py index da8321b41..27db6d732 100644 --- a/commentaries/models.py +++ b/commentaries/models.py @@ -4,7 +4,7 @@ from django.core.urlresolvers import reverse from django.template import Template, Context from journals.constants import SCIPOST_JOURNALS_DOMAINS -from scipost.behaviors import ArxivCallable, TimeStampedModel +from scipost.behaviors import TimeStampedModel from scipost.models import Contributor from scipost.constants import SCIPOST_DISCIPLINES, DISCIPLINE_PHYSICS, SCIPOST_SUBJECT_AREAS @@ -12,7 +12,7 @@ from .constants import COMMENTARY_TYPES from .managers import CommentaryManager -class Commentary(ArxivCallable, TimeStampedModel): +class Commentary(TimeStampedModel): """ A Commentary contains all the contents of a SciPost Commentary page for a given publication. """ @@ -72,10 +72,6 @@ class Commentary(ArxivCallable, TimeStampedModel): def __str__(self): return self.pub_title - @classmethod - def same_version_exists(self, identifier): - return self.objects.filter(arxiv_identifier=identifier).exists() - def title_label(self): context = Context({ 'scipost_url': reverse('commentaries:commentary', args=(self.arxiv_or_DOI_string,)), diff --git a/scipost/behaviors.py b/scipost/behaviors.py index 1140c889d..7904262e9 100644 --- a/scipost/behaviors.py +++ b/scipost/behaviors.py @@ -4,16 +4,6 @@ from django.utils import timezone from .db.fields import AutoDateTimeField -class ArxivCallable(object): - '''Models that contain a Arxiv identification should contain these - methods to be compatible with the ArxivCaller(). - ''' - @classmethod - def same_version_exists(self, identifier): - '''Check if the given identifier already is present in the database.''' - raise NotImplementedError - - class TimeStampedModel(models.Model): """ All objects should inherit from this abstract model. diff --git a/scipost/services.py b/scipost/services.py index 7a6707e8f..9e61ccd73 100644 --- a/scipost/services.py +++ b/scipost/services.py @@ -1,15 +1,9 @@ # Module for making external api calls as needed in the submissions cycle import feedparser import requests -import re import datetime import dateutil.parser -from django.template import Template, Context -from .behaviors import ArxivCallable - -from strings import arxiv_caller_errormessages - class DOICaller: def __init__(self, doi_string): diff --git a/submissions/models.py b/submissions/models.py index 8e887cc01..2ecdcd874 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -16,7 +16,6 @@ from .managers import SubmissionManager, EditorialAssignmentManager, EICRecommen from .utils import ShortSubmissionCycle, DirectRecommendationSubmissionCycle,\ GeneralSubmissionCycle -from scipost.behaviors import ArxivCallable from scipost.constants import TITLE_CHOICES from scipost.fields import ChoiceArrayField from scipost.models import Contributor @@ -28,7 +27,7 @@ from journals.models import Publication ############### # Submissions: ############### -class Submission(ArxivCallable, models.Model): +class Submission(models.Model): # Main submission fields author_comments = models.TextField(blank=True, null=True) author_list = models.CharField(max_length=1000, verbose_name="author list") @@ -164,6 +163,19 @@ class Submission(ArxivCallable, models.Model): return self.reports.awaiting_vetting().count() +class SubmissionEvent(models.Model): + partner = models.ForeignKey('partners.Partner', on_delete=models.CASCADE, + related_name='events') + event = models.CharField(max_length=64, choices=PARTNER_EVENTS) + comments = models.TextField(blank=True) + noted_on = models.DateTimeField(auto_now_add=True) + noted_by = models.ForeignKey(User, on_delete=models.CASCADE) + + def __str__(self): + return '%s: %s' % (str(self.partner), self.get_event_display()) + + + ###################### # Editorial workflow # ###################### -- GitLab