Commit 7274a20f by Clinton Blackburn Committed by Clinton Blackburn

Created Schedule model

This model will be used to control dynamic upgrade deadlines for
learners.
parent dab4728f
......@@ -2241,8 +2241,8 @@ INSTALLED_APPS = (
# Unusual migrations
'database_fixups',
# Waffle related utilities
'openedx.core.djangoapps.waffle_utils',
'openedx.core.djangoapps.schedules',
# Features
'openedx.features.course_bookmarks',
......@@ -2251,7 +2251,6 @@ INSTALLED_APPS = (
'openedx.features.enterprise_support',
'openedx.features.learner_profile',
# Experiments
'experiments',
# DRF filters
......
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from . import models
@admin.register(models.Schedule)
class ScheduleAdmin(admin.ModelAdmin):
list_display = ('username', 'course_id', 'active', 'start', 'upgrade_deadline')
raw_id_fields = ('enrollment',)
readonly_fields = ('modified',)
search_fields = ('enrollment__user__username', 'enrollment__course_id',)
def username(self, obj):
return obj.enrollment.user.username
username.short_description = _('Username')
def course_id(self, obj):
return obj.enrollment.course_id
course_id.short_description = _('Course ID')
def get_queryset(self, request):
qs = super(ScheduleAdmin, self).get_queryset(request)
qs = qs.select_related('enrollment', 'enrollment__user')
return qs
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('student', '0010_auto_20170207_0458'),
]
operations = [
migrations.CreateModel(
name='Schedule',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
('active', models.BooleanField(default=True, help_text='Indicates if this schedule is actively used')),
('start', models.DateTimeField(help_text='Date this schedule went into effect')),
('upgrade_deadline', models.DateTimeField(help_text='Deadline by which the learner must upgrade to a verified seat', null=True, blank=True)),
('enrollment', models.OneToOneField(to='student.CourseEnrollment')),
],
options={
'verbose_name': 'Schedule',
'verbose_name_plural': 'Schedules',
},
),
]
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.models import TimeStampedModel
class Schedule(TimeStampedModel):
enrollment = models.OneToOneField('student.CourseEnrollment', null=False)
active = models.BooleanField(default=True, help_text=_('Indicates if this schedule is actively used'))
start = models.DateTimeField(help_text=_('Date this schedule went into effect'))
upgrade_deadline = models.DateTimeField(
blank=True,
null=True,
help_text=_('Deadline by which the learner must upgrade to a verified seat')
)
class Meta(object):
verbose_name = _('Schedule')
verbose_name_plural = _('Schedules')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment