本文整理汇总了Python中south.migration.base.Migrations._clear_cache方法的典型用法代码示例。如果您正苦于以下问题:Python Migrations._clear_cache方法的具体用法?Python Migrations._clear_cache怎么用?Python Migrations._clear_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类south.migration.base.Migrations
的用法示例。
在下文中一共展示了Migrations._clear_cache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _clear_south_cache
# 需要导入模块: from south.migration.base import Migrations [as 别名]
# 或者: from south.migration.base.Migrations import _clear_cache [as 别名]
def _clear_south_cache(self):
for mig in list(migration.all_migrations()):
try:
delattr(mig._application, "migrations")
except AttributeError:
pass
Migrations._clear_cache()
示例2: _clear_south_cache
# 需要导入模块: from south.migration.base import Migrations [as 别名]
# 或者: from south.migration.base.Migrations import _clear_cache [as 别名]
def _clear_south_cache(self):
for mig in list(migration.all_migrations()):
delattr(mig._application, "migrations")
Migrations._clear_cache()
for mig in list(migration.all_migrations()):
for m in mig:
m.calculate_dependencies()
mig._dependencies_done = False
示例3: create_models
# 需要导入模块: from south.migration.base import Migrations [as 别名]
# 或者: from south.migration.base.Migrations import _clear_cache [as 别名]
def create_models(self):
models_cache.app_models[settings.DYNAMIC_MODELS_APP] = SortedDict()
for model_name, model_info in self.models_settings.iteritems():
m_name = "".join([s.capitalize() for s in str(model_name).split('_')])
class Meta:
pass
setattr(Meta, 'app_label', settings.DYNAMIC_MODELS_APP)
setattr(Meta, 'verbose_name', model_info['title'])
setattr(Meta, 'verbose_name_plural', model_info['title'])
fields = self._create_model_fields(model_info['fields'])
fields['Meta'] = Meta
fields['__module__'] = settings.DYNAMIC_MODELS_APP + '.models'
cls = type(m_name, (models.Model, ), fields)
try:
admin.site.register(cls)
except AlreadyRegistered:
pass
try:
try:
try:
Migrations(settings.DYNAMIC_MODELS_APP)
management.call_command('schemamigration', settings.DYNAMIC_MODELS_APP, auto=True)
except NoMigrations:
management.call_command('schemamigration', settings.DYNAMIC_MODELS_APP, initial=True)
except (SystemExit, Exception):
pass
Migrations._clear_cache()
try:
management.call_command('migrate', settings.DYNAMIC_MODELS_APP)
except SystemExit:
pass
except Exception:
pass
示例4: _clear_south_cache
# 需要导入模块: from south.migration.base import Migrations [as 别名]
# 或者: from south.migration.base.Migrations import _clear_cache [as 别名]
def _clear_south_cache(self):
for mig in list(migration.all_migrations()):
delattr(mig._application, "migrations")
Migrations._clear_cache()