Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions errata/migrations/0049_alter_errata_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.4 on 2021-07-20 17:55

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('errata', '0048_auto_20200807_1056'),
]

operations = [
migrations.AlterField(
model_name='errata',
name='status',
field=models.CharField(choices=[('New', 'New'), ('Editorial Review', 'Editorial Review'), ('K-12 Editorial Review', 'K-12 Editorial Review'), ('Associate Editorial Review', 'Kelsey Editorial Review'), ('Anthony Editorial Review', 'Anthony Editorial Review'), ('Reviewed', 'Reviewed'), ('Completed', 'Completed')], default='New', max_length=100),
),
]
32 changes: 5 additions & 27 deletions errata/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@

NEW = 'New'
EDITORIAL_REVIEW = 'Editorial Review'
ANDREW_EDITORIAL_REVIEW = 'Andrew Editorial Review'
K12_EDITORIAL_REVIEW = 'K-12 Editorial Review'
ASSOCIATE_EDITORIAL_REVIEW = 'Associate Editorial Review'
ANTHONY_EDITORIAL_REVIEW = 'Anthony Editorial Review'
REVIEWED = 'Reviewed'
COMPLETED = 'Completed'
ERRATA_STATUS = (
(NEW, 'New'),
(EDITORIAL_REVIEW, 'Editorial Review'),
(ANDREW_EDITORIAL_REVIEW, 'Andrew Editorial Review'),
(K12_EDITORIAL_REVIEW, 'K-12 Editorial Review'),
(ASSOCIATE_EDITORIAL_REVIEW, 'Kelsey Editorial Review'),
(ANTHONY_EDITORIAL_REVIEW,'Anthony Editorial Review'),
(REVIEWED, 'Reviewed'),
(COMPLETED, 'Completed'),
Expand Down Expand Up @@ -210,30 +212,6 @@ class Errata(models.Model):
file_1 = models.FileField(upload_to='errata/user_uploads/1/', blank=True, null=True)
file_2 = models.FileField(upload_to='errata/user_uploads/2/', blank=True, null=True)

# @property
# def user_email(self):
# try:
# user = get_user_info(self.submitted_by_account_id)
# return user['email']
# except:
# return None
#
# @property
# def user_name(self):
# try:
# user = get_user_info(self.submitted_by_account_id)
# return user['fullname']
# except:
# return None
#
# @property
# def user_faculty_status(self):
# try:
# user = get_user_info(self.submitted_by_account_id)
# return user['faculty_status']
# except:
# return None

@property
def accounts_link(self):
try:
Expand All @@ -248,7 +226,7 @@ def short_detail(self):
def clean(self):
if self.status == 'Completed' and not self.resolution or self.status == 'Reviewed' and not self.resolution:
raise ValidationError({'resolution': 'Resolution is required if status is completed or reviewed.'})
if (self.status == 'Editorial Review' or self.status == 'Andrew Editorial Review' or self.status == 'Anthony Editorial Review' or self.status == 'Reviewed' or self.status == 'Completed') and not self.is_assessment_errata:
if (self.status == 'Editorial Review' or self.status == 'K-12 Editorial Review' or self.status == 'Associate Editorial Review' or self.status == 'Anthony Editorial Review' or self.status == 'Reviewed' or self.status == 'Completed') and not self.is_assessment_errata:
raise ValidationError({'is_assessment_errata': 'You must specify if this is an assessment errata.'})
if (self.status == 'Completed' and self.resolution == 'Duplicate') and not self.duplicate_id:
raise ValidationError({'duplicate_id': 'You must specify the duplicate report ID when resolution is marked duplicate.'})
Expand Down