Merge pull request #23283 from edx/ndalfonso/AA-12-reset-deadlines

AA-12 reset self paced due dates
This commit is contained in:
Nick
2020-03-04 15:42:46 -05:00
committed by GitHub
13 changed files with 158 additions and 5 deletions

View File

@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-03-03 18:36
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
import simple_history.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('schedules', '0012_auto_20200302_1914'),
]
operations = [
migrations.CreateModel(
name='HistoricalSchedule',
fields=[
('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
('active', models.BooleanField(default=True, help_text='Indicates if this schedule is actively used')),
('start', models.DateTimeField(db_index=True, help_text='Date this schedule went into effect')),
('start_date', models.DateTimeField(db_index=True, help_text='Date this schedule went into effect')),
('upgrade_deadline', models.DateTimeField(blank=True, db_index=True, help_text='Deadline by which the learner must upgrade to a verified seat', null=True)),
('history_id', models.AutoField(primary_key=True, serialize=False)),
('history_date', models.DateTimeField()),
('history_change_reason', models.CharField(max_length=100, null=True)),
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
('enrollment', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='student.CourseEnrollment')),
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
],
options={
'get_latest_by': 'history_date',
'ordering': ('-history_date', '-history_id'),
'verbose_name': 'historical Schedule',
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
]

View File

@@ -6,6 +6,7 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
from model_utils.models import TimeStampedModel
from simple_history.models import HistoricalRecords
class Schedule(TimeStampedModel):
@@ -33,6 +34,7 @@ class Schedule(TimeStampedModel):
null=True,
help_text=_('Deadline by which the learner must upgrade to a verified seat')
)
history = HistoricalRecords()
def get_experience_type(self):
try: