0002_states_fixtures.py 文件源码

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

项目:PublicAPI 作者: InternetSemLimites 项目源码 文件源码
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])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号