I am sure that I am doing something really obviously stupid, but I tried to figure it out for several hours and nothing jumps at me.
I use ModelForm, so I can set several fields from the model for editing. 2x ImageField, 1x TextField. The form is being processed and the TextField is working. Two ImageFields do not work, which is why I am here today.
I am using Django 1.0.2
Here is the relevant code (ask if you need more - and I donβt include HTML, because this part works fine):
Model:
class Company(models.Model):
View and form:
def admin_edit(request, company_slug): company = get_object_or_404(Company, slug = company_slug) f = AdminEditForm(instance = company) if request.method == 'POST': f = AdminEditForm(request.POST, instance = company) if f.is_valid(): print "Processing form" print f.cleaned_data['intro_pic'] f.save() return render_to_response('uadmin/edit.html', {'company':company, 'f':f}, RequestContext(request)) class AdminEditForm(ModelForm): class Meta: model = Company fields = ['logo', 'intro_pic', 'intro_text']
django django-models django-forms
Oli Mar 25 '09 at 9:06 2009-03-25 09:06
source share