当前位置: 首页>>代码示例>>Python>>正文


Python SiteConfiguration.get_all_orgs方法代码示例

本文整理汇总了Python中openedx.core.djangoapps.site_configuration.models.SiteConfiguration.get_all_orgs方法的典型用法代码示例。如果您正苦于以下问题:Python SiteConfiguration.get_all_orgs方法的具体用法?Python SiteConfiguration.get_all_orgs怎么用?Python SiteConfiguration.get_all_orgs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openedx.core.djangoapps.site_configuration.models.SiteConfiguration的用法示例。


在下文中一共展示了SiteConfiguration.get_all_orgs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_all_orgs

# 需要导入模块: from openedx.core.djangoapps.site_configuration.models import SiteConfiguration [as 别名]
# 或者: from openedx.core.djangoapps.site_configuration.models.SiteConfiguration import get_all_orgs [as 别名]
    def test_get_all_orgs(self):
        """
        Test that get_all_orgs returns all orgs from site configuration.
        """
        expected_orgs = [self.test_config1["course_org_filter"], self.test_config2["course_org_filter"]]
        # add SiteConfiguration to database
        SiteConfigurationFactory.create(site=self.site, values=self.test_config1)
        SiteConfigurationFactory.create(site=self.site2, values=self.test_config2)

        # Test that the default value is returned if the value for the given key is not found in the configuration
        self.assertListEqual(list(SiteConfiguration.get_all_orgs()), expected_orgs)
开发者ID:hastexo,项目名称:edx-platform,代码行数:13,代码来源:test_models.py

示例2: test_get_all_orgs_returns_only_enabled

# 需要导入模块: from openedx.core.djangoapps.site_configuration.models import SiteConfiguration [as 别名]
# 或者: from openedx.core.djangoapps.site_configuration.models.SiteConfiguration import get_all_orgs [as 别名]
    def test_get_all_orgs_returns_only_enabled(self):
        """
        Test that get_all_orgs returns only those orgs whose configurations are enabled.
        """
        expected_orgs = [self.test_config2["course_org_filter"]]
        # add SiteConfiguration to database
        SiteConfigurationFactory.create(site=self.site, values=self.test_config1, enabled=False)
        SiteConfigurationFactory.create(site=self.site2, values=self.test_config2)

        # Test that the default value is returned if the value for the given key is not found in the configuration
        self.assertListEqual(list(SiteConfiguration.get_all_orgs()), expected_orgs)
开发者ID:hastexo,项目名称:edx-platform,代码行数:13,代码来源:test_models.py

示例3: get_all_orgs

# 需要导入模块: from openedx.core.djangoapps.site_configuration.models import SiteConfiguration [as 别名]
# 或者: from openedx.core.djangoapps.site_configuration.models.SiteConfiguration import get_all_orgs [as 别名]
def get_all_orgs():
    """
    This returns all of the orgs that are considered in site configurations or microsite configuration,
    This can be used, for example, to do filtering.

    Returns:
        A list of all organizations present in either microsite configuration or site configuration.
    """
    site_configuration_orgs = SiteConfiguration.get_all_orgs()
    microsite_orgs = microsite.get_all_orgs()

    return site_configuration_orgs.union(microsite_orgs)
开发者ID:CraftAcademy,项目名称:edx-platform,代码行数:14,代码来源:helpers.py

示例4: get_all_orgs

# 需要导入模块: from openedx.core.djangoapps.site_configuration.models import SiteConfiguration [as 别名]
# 或者: from openedx.core.djangoapps.site_configuration.models.SiteConfiguration import get_all_orgs [as 别名]
def get_all_orgs():
    """
    This returns all of the orgs that are considered in site configurations or microsite configuration,
    This can be used, for example, to do filtering.

    Returns:
        A list of all organizations present in either microsite configuration or site configuration.
    """
    # Import is placed here to avoid model import at project startup.
    from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
    site_configuration_orgs = SiteConfiguration.get_all_orgs()
    microsite_orgs = microsite.get_all_orgs()

    return site_configuration_orgs.union(microsite_orgs)
开发者ID:edx,项目名称:edx-platform,代码行数:16,代码来源:helpers.py


注:本文中的openedx.core.djangoapps.site_configuration.models.SiteConfiguration.get_all_orgs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。