def execute_fixture(name):
filename = os.path.join(FIXTURE_DIR, name + '.json')
connection = connections["default"]
with connection.constraint_checks_disabled():
with open(filename, "r") as stream:
objects = serializers.deserialize("json", stream)
for obj in objects:
if hasattr(obj.object, "_cache_data"):
obj.object._cache_data()
obj.save()
评论列表
文章目录