我想傳遞一個「組」爲使用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