migration_utils.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:intake 作者: codeforamerica 项目源码 文件源码
def load_fixture(cls, fixture_spec, apps, schema_editor):
        app_name, model_name, fixture_file_name = fixture_spec
        original_apps = serializers.python.apps
        serializers.python.apps = apps
        queryset = cls.get_model_class(app_name, model_name,
                                       apps, schema_editor)
        path, fixture_type = cls.fixture_path(app_name, fixture_file_name)
        fixture_file = open(path)
        objects = serializers.deserialize(fixture_type,
                                          fixture_file,
                                          ignorenonexistent=True)
        for obj in objects:
            cls.update_or_create_object(obj, queryset)
        fixture_file.close()
        serializers.python.apps = original_apps
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号