Commit 3988a349 by Ned Batchelder Committed by GitHub

Merge pull request #14474 from open-craft/smarnach/ficus-migrations

Remove migration deleting XBlockDisableConfig model to allow zero-downtime release upgrades.
parents 09c4c77b e65909a6
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('xblock_django', '0003_add_new_config_models'),
]
operations = [
migrations.RemoveField(
model_name='xblockdisableconfig',
name='changed_by',
),
migrations.DeleteModel(
name='XBlockDisableConfig',
),
]
......@@ -8,6 +8,43 @@ from django.utils.translation import ugettext_lazy as _
from config_models.models import ConfigurationModel
class XBlockDisableConfig(ConfigurationModel):
"""
Configuration for disabling and deprecating XBlocks.
"""
class Meta(ConfigurationModel.Meta):
app_label = 'xblock_django'
disabled_blocks = TextField(
default='', blank=True,
help_text=_('Space-separated list of XBlocks which should not render.')
)
disabled_create_blocks = TextField(
default='', blank=True,
help_text=_(
"Space-separated list of XBlock types whose creation to disable in Studio."
)
)
@classmethod
def is_block_type_disabled(cls, block_type):
""" Return True if block_type is disabled. """
config = cls.current()
if not config.enabled:
return False
return block_type in config.disabled_blocks.split()
def __unicode__(self):
config = XBlockDisableConfig.current()
return u"Disabled xblocks = {disabled_xblocks}".format(
disabled_xblocks=config.disabled_blocks
)
class XBlockConfiguration(ConfigurationModel):
"""
XBlock configuration used by both LMS and Studio, and not specific to a particular template.
......
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