Python Django尝试上传文件

Python Django尝试上传文件,python,django,Python,Django,当我尝试上传文件时遇到问题 Traceback (most recent call last): ............... 290, in pre_save if file and not file._committed: AttributeError: 'MultiValueDict' object has no attribute '_committed' class UserFiles(models.Model): user = models.ForeignK

当我尝试上传文件时遇到问题

Traceback (most recent call last):
    ...............

290, in pre_save if file and not file._committed:
AttributeError: 'MultiValueDict' object has no attribute '_committed'


class UserFiles(models.Model):
     user = models.ForeignKey(User)
     file_name = models.CharField(max_length=255, null=True)
     file = models.FileField(blank=True,
                        upload_to='media/files/users_file/', null=True)
     def __unicode__(self):
         return u'%s' % self.user

如何解决此问题?

添加更多详细信息,您试图通过管理员界面或自定义表单上载文件?如果是,是配置问题还是代码问题?显示与您的问题相关的特定文件。您是否也可以上载相关视图?