0
我想將csv文件導入到我的SQL數據庫。這裏是我的模型:用Django適配器導入CSV文件:Db模型不應該定義任何csv字段
class Matchups(models.Model):
name = models.CharField(max_length=140)
vs_Ashe = models.CharField(max_length=140)
def __unicode__(self):
return "%s" % (self.name)
class MyCsvModel(CsvDbModel):
name = CharField()
vs_Ashe = CharField()
class Meta:
dbModel = Matchups
delimiter = ","
試圖導入CSV文件:my_csv_list = MyCsvModel.import_data(data = open("/home/irmantas/ADC.csv"))
我得到這個錯誤:
A Db model should not have any csv field defined.
問題是什麼?