Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
05dd63e8
Unverified
Commit
05dd63e8
authored
Oct 26, 2017
by
Gabe Mulley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests, I hope?
parent
806114a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
13 deletions
+37
-13
lms/djangoapps/courseware/migrations/0005_orgdynamicupgradedeadlineconfiguration.py
+10
-0
lms/djangoapps/courseware/models.py
+27
-13
No files found.
lms/djangoapps/courseware/migrations/0005_orgdynamicupgradedeadlineconfiguration.py
View file @
05dd63e8
...
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
...
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
from
django.db
import
migrations
,
models
from
django.db
import
migrations
,
models
import
django.db.models.deletion
import
django.db.models.deletion
from
django.conf
import
settings
from
django.conf
import
settings
import
courseware.models
class
Migration
(
migrations
.
Migration
):
class
Migration
(
migrations
.
Migration
):
...
@@ -25,5 +26,14 @@ class Migration(migrations.Migration):
...
@@ -25,5 +26,14 @@ class Migration(migrations.Migration):
(
'opt_out'
,
models
.
BooleanField
(
default
=
False
,
help_text
=
'Disable the dynamic upgrade deadline for this organization.'
)),
(
'opt_out'
,
models
.
BooleanField
(
default
=
False
,
help_text
=
'Disable the dynamic upgrade deadline for this organization.'
)),
(
'changed_by'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
editable
=
False
,
to
=
settings
.
AUTH_USER_MODEL
,
null
=
True
,
verbose_name
=
'Changed by'
)),
(
'changed_by'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
editable
=
False
,
to
=
settings
.
AUTH_USER_MODEL
,
null
=
True
,
verbose_name
=
'Changed by'
)),
],
],
options
=
{
'ordering'
:
(
'-change_date'
,),
'abstract'
:
False
,
},
bases
=
(
courseware
.
models
.
OptOutDynamicUpgradeDeadlineMixin
,
models
.
Model
),
),
migrations
.
AlterModelOptions
(
name
=
'coursedynamicupgradedeadlineconfiguration'
,
options
=
{
'ordering'
:
(
'-change_date'
,)},
),
),
]
]
lms/djangoapps/courseware/models.py
View file @
05dd63e8
...
@@ -379,27 +379,21 @@ class DynamicUpgradeDeadlineConfiguration(ConfigurationModel):
...
@@ -379,27 +379,21 @@ class DynamicUpgradeDeadlineConfiguration(ConfigurationModel):
)
)
class
OptOutDynamicUpgradeDeadlineConfiguration
(
DynamicUpgradeDeadlineConfiguration
):
class
OptOutDynamicUpgradeDeadlineMixin
(
object
):
""" Dynamic upgrade deadline configuration with opt-out switch.
"""
Provides convenience methods for interpreting the enabled and opt out status.
This is an abstract model that both CourseDynamicUpgradeDeadlineConfiguration and
OrgDynamicUpgradeDeadlineConfiguration inherit.
"""
"""
opt_out
=
models
.
BooleanField
(
default
=
False
,
help_text
=
_
(
'Disable the dynamic upgrade deadline for this course run.'
)
)
def
opted_in
(
self
):
def
opted_in
(
self
):
"""Conv
ien
ence function that returns True if this config model is both enabled and opt_out is False"""
"""Conv
eni
ence function that returns True if this config model is both enabled and opt_out is False"""
return
self
.
enabled
and
not
self
.
opt_out
return
self
.
enabled
and
not
self
.
opt_out
def
opted_out
(
self
):
def
opted_out
(
self
):
"""Conv
ien
ence function that returns True if this config model is both enabled and opt_out is True"""
"""Conv
eni
ence function that returns True if this config model is both enabled and opt_out is True"""
return
self
.
enabled
and
self
.
opt_out
return
self
.
enabled
and
self
.
opt_out
class
CourseDynamicUpgradeDeadlineConfiguration
(
OptOutDynamicUpgradeDeadline
Configuration
):
class
CourseDynamicUpgradeDeadlineConfiguration
(
OptOutDynamicUpgradeDeadline
Mixin
,
ConfigurationModel
):
"""
"""
Per-course run configuration for dynamic upgrade deadlines.
Per-course run configuration for dynamic upgrade deadlines.
...
@@ -410,8 +404,18 @@ class CourseDynamicUpgradeDeadlineConfiguration(OptOutDynamicUpgradeDeadlineConf
...
@@ -410,8 +404,18 @@ class CourseDynamicUpgradeDeadlineConfiguration(OptOutDynamicUpgradeDeadlineConf
course_id
=
CourseKeyField
(
max_length
=
255
,
db_index
=
True
)
course_id
=
CourseKeyField
(
max_length
=
255
,
db_index
=
True
)
deadline_days
=
models
.
PositiveSmallIntegerField
(
default
=
21
,
help_text
=
_
(
'Number of days a learner has to upgrade after content is made available'
)
)
class
OrgDynamicUpgradeDeadlineConfiguration
(
OptOutDynamicUpgradeDeadlineConfiguration
):
opt_out
=
models
.
BooleanField
(
default
=
False
,
help_text
=
_
(
'Disable the dynamic upgrade deadline for this course run.'
)
)
class
OrgDynamicUpgradeDeadlineConfiguration
(
OptOutDynamicUpgradeDeadlineMixin
,
ConfigurationModel
):
"""
"""
Per-org configuration for dynamic upgrade deadlines.
Per-org configuration for dynamic upgrade deadlines.
...
@@ -421,3 +425,13 @@ class OrgDynamicUpgradeDeadlineConfiguration(OptOutDynamicUpgradeDeadlineConfigu
...
@@ -421,3 +425,13 @@ class OrgDynamicUpgradeDeadlineConfiguration(OptOutDynamicUpgradeDeadlineConfigu
KEY_FIELDS
=
(
'org_id'
,)
KEY_FIELDS
=
(
'org_id'
,)
org_id
=
models
.
CharField
(
max_length
=
255
,
db_index
=
True
)
org_id
=
models
.
CharField
(
max_length
=
255
,
db_index
=
True
)
deadline_days
=
models
.
PositiveSmallIntegerField
(
default
=
21
,
help_text
=
_
(
'Number of days a learner has to upgrade after content is made available'
)
)
opt_out
=
models
.
BooleanField
(
default
=
False
,
help_text
=
_
(
'Disable the dynamic upgrade deadline for this organization.'
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment