コード例 #1
0
from stats.models import Stats

data = csv.reader(open("/home/django/mmashnik/fighters.csv"), delimiter=',')

for row in data:
    post = Stats()
    post.id = row[0]
    post.image_stats = row[1]
    post.first_name = row[2]
    post.last_name = row[3]
    post.nick_name = row[4]
    post.date_of_birth = row[5]
    post.place_of_birth = row[6]
    post.height = row[7]
    post.weight = row[8]
    post.weight_class = row[9]
    post.win = row[10]
    post.ko_win = row[11]
    post.sub_win = row[12]
    post.dec_win = row[13]
    post.other_win = row[14]
    post.loss = row[15]
    post.ko_loss = row[16]
    post.sub_loss = row[17]
    post.dec_loss = row[18]
    post.other_loss = row[19]
    post.draw = row[20]
    post.nc = row[21]
    post.record = row[22]
    post.save()