我想传递一个“组”为使用importer-option从django-adaptors一个额外的领域,但我发现了以下错误......的add()*后的参数必须是一个序列,不组
加()参数*后必须是一个序列,不
ContactCSVModel.import_data(data=self.filepath, extra_fields="1")
这是我CsvModel集团...
CsvModel.py
class ContactCSVModel(CsvModel):
first_name = CharField()
last_name = CharField()
company = CharField()
mobile = CharField()
groups = DjangoModelField(Group)
class Meta:
delimiter = "^"
dbModel = Contact
update = {
'keys': ['mobile']
}
model.py
class Contact(models.Model):
"""
Stores all contacts.
"""
first_name = models.CharField(max_length=60)
last_name = models.CharField(max_length=60)
company = models.CharField(max_length=100,blank=True)
mobile = models.IntegerField(max_length=20)
active = models.BooleanField(help_text="States if pet type is active/selectable.")
modified = models.DateTimeField(null=True, auto_now=True, help_text="Shows when object was modified.")
created = models.DateTimeField(auto_now_add=True, help_text="Shows when object was created.")
#FK
groups = models.ManyToManyField(Group, related_name='contacts')
上的git(下同),莫不是与项目和many2many领域,也许任何问题,在项目看,如果这样如何解决?或者它是我的代码?
https://github.com/anthony-tresontani/django-adaptors/blob/master/adaptor/model.py#L436
你能张贴整个回溯? – Willian 2013-03-17 20:28:00
我无法使您的示例工作,您是否也可以发布您的CSV文件样本? – Ponytech 2013-03-18 12:09:13
这个问题可能是因为它的ManyToManyField,我尝试了一个简单的FK,这工作。也许是一个bug – 2013-03-18 23:00:47