def create_states(apps, schema_editor):
State = apps.get_model('core', 'State')
fixture_file = ('InternetSemLimites', 'core', 'fixtures', 'states.csv')
fixture_path = path.join(settings.BASE_DIR, *fixture_file)
with open(fixture_path, encoding='utf-8') as fh:
for line in reader(fh):
State.objects.create(name=line[1], abbr=line[0])
0002_states_fixtures.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录