我无法让它工作:
def _get_image_name(filename):
return 'asdf'
class ImageUploadForm(forms.Form):
name = forms.CharField()
file = forms.ImageField(upload_to=_get_image_name)
运行此程序时,我得到“ init () got an unexpected keyword argument 'upload_to'”。我的 django 版本是 1.6。