I'm having a massive headache. I have a Model called companies with vaious fields but for one form, I want the user to be able to edit two ImageFields and a TextField. "Simple", I thought and quickly made a ModelForm class:
class AdminEditForm(ModelForm): class Meta: model = Company fields = ['logo', 'intro_pic', 'intro_text'] I hooked it up in this view: 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.copy(), instance = company) if f.is_valid(): print "Processing form" print f.cleaned_data['intro_pic'] print f.cleaned_data['logo'] f.save() return render_to_response('uadmin/edit.html', {'company':company, 'f':f}, RequestContext(request)) Here are the relevant parts of the model definition: class Company(models.Model): logo = models.ImageField(upload_to='logos', blank=True) intro_pic = models.ImageField(upload_to='intropics', blank=True) intro_text = models.TextField(blank=True) The form *is* working -- it validates and intro_text is saved -- it's just the images not saving. I've hooked out the POST and displayed it on the form and it is getting data through from the file inputs: QueryDict: {u'logo': [u'oli.png'], u'intro_text': [u'This is some text!'], u'intro_pic': [u'oli.png']} Uploading from the [proper] admin edit form works fine so I don't think it's a PIL issue. Any ideas? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---