我有一个django模型如下:
class XML(ExtensibleModel):
xml = models.FileField(upload_to='xml',blank=True, null=True)
在这里,我存储了一些xmls文件。之前,我通过html表单将文件提交到服务器。现在,我通过ssh复制文件,并希望继续将新文件存储在此模型中。问题是我做不到。我试着用下面的代码
f = open(FILENAME,'r')
A = XML(xml = f)
A.save()
但是,我得到一个错误:
'file' object has no attribute '_committed'
你知道吗?你知道吗
尝试使用django file而不仅仅是打开的文件。你知道吗
相关问题 更多 >
编程相关推荐