I have a model and form like so:
class Image(BaseModel):
original = db.BlobProperty()
class ImageForm(ModelForm):
class Meta:
model = Image
I do the following in my view:
form = ImageForm(request.POST, request.FILES, instance=image)
if form.is_valid():
And I get:
AttributeError at /image/add/
‘NoneType’ object has no attribute
‘validate’
Traced to:
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/djangoforms.py
in property_clean
- value: The value to validate.
606.- Raises:
- forms.ValidationError if the value cannot be validated.
- “””
- if value is not None:
try:
prop.validate(prop.make_value_from_form(value))
…except (db.BadValueError, ValueError), e:
- raise forms.ValidationError(unicode(e))
615.
616.- class ModelFormOptions(object):
- “””A simple class to hold internal options for a ModelForm
class.▼ Local vars
prop None
value InMemoryUploadedFile: Nearby.jpg (image/jpeg)
Any ideas how to get it to validate? It looks like FileField does not have a validate method, which Django expects…
It doesn’t work with default django version. And bug is reported.
BTW, default installation raise other exeption. So possible problem with other part of your code.