本文整理汇总了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
示例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