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


Python Migrations.migration方法代码示例

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


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

示例1: custom_user_frozen_models

# 需要导入模块: from south.migration.base import Migrations [as 别名]
# 或者: from south.migration.base.Migrations import migration [as 别名]
def custom_user_frozen_models(user_model):
    migration_name = getattr(settings, 'INITIAL_CUSTOM_USER_MIGRATION',
                             '0001_initial.py')
    if user_model != 'auth.User':
        from south.migration.base import Migrations
        from south.exceptions import NoMigrations
        from south.creator.freezer import freeze_apps
        user_app, user_model = user_model.split('.')
        try:
            user_migrations = Migrations(user_app)
        except NoMigrations:
            extra_model = freeze_apps(user_app)
        else:
            initial_user_migration = user_migrations.migration(migration_name)
            extra_model = initial_user_migration.migration_class().models
    else:
        extra_model = {}
    return extra_model
开发者ID:Memrise,项目名称:django-social-auth,代码行数:20,代码来源:utils.py

示例2: get_user_frozen_models

# 需要导入模块: from south.migration.base import Migrations [as 别名]
# 或者: from south.migration.base.Migrations import migration [as 别名]
def get_user_frozen_models(user_model):
    from south.creator.freezer import freeze_apps
    user_app, user_class = user_model.split('.')
    if user_model != 'auth.User':
        from south.migration.base import Migrations
        from south.exceptions import NoMigrations
        try:
            user_migrations = Migrations(user_app)
        except NoMigrations:
            extra_model = freeze_apps(user_app)
        else:
            from pybb import defaults
            migration_name = defaults.PYBB_INITIAL_CUSTOM_USER_MIGRATION or '0001_initial.py'
            initial_user_migration = user_migrations.migration(migration_name)
            extra_model = initial_user_migration.migration_class().models
    else:
        extra_model = freeze_apps(user_app)
    return extra_model
开发者ID:TechMobileSoftware,项目名称:pybbm,代码行数:20,代码来源:compat.py


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