I have a such model in django 1.6:
class Instance(models.Model):
...
image = models.ImageField(upload_to='flats_photo',null=True, blank=True)
...
Form:
class InstanceForm(ModelForm):
class Meta:
model = Instance
fields=[...,'image',...]
When I create new object I use such view:
def add_instance(request):
if request.POST:
form=InstanceForm(request.POST)
if form.is_valid():
f = InstanceForm(request.POST)
new_instance=f.save()
else:form=InstanceForm()
locals().update(csrf(request))
return render_to_response(...)
All fields of new object create, but not field image.There is no image. In django admin I see: Image no file selected. Everything work good when i add object from admin. How to solve this problem