Probably fixed. :-)

Batiste a écrit :

> Hi,
>
> Form this model
> -------------------------------------
> class Image(meta.Model):
>     class META:
>         admin = meta.Admin()
>     image = meta.ImageField(upload_to='images')
>     annonce = meta.ForeignKey(Annonce,verbose_name="L'annonce")
>     def __repr__(self):
>        return self.image
> ----------------------------------
> I try to make something pretty simple
> ----------------------------------
> def publierMedia(request,annonce_id):
>     manipulator = images.AddManipulator()
>     if request.POST:
>         new_data = request.POST.copy()
>         errors = manipulator.get_validation_errors(new_data)
>         if not errors:
>             manipulator.do_html2python(new_data)
>             new_annonce = manipulator.save(new_data)
>             return HttpResponseRedirect("/" % new_annonce.id)
>     else:
>         errors = new_data = {}
>     form = formfields.FormWrapper(manipulator, new_data, errors)
>     return render_to_response('monlogis/publier-media', {'form': form,
> 'logged_annonceur': getLoggedAnnonceur(request),'user': request.user})
> ----------------------------------
>
> U have installed PIL and I have set my MEDIA_ROOT and my MEDIA_URL
> variable but I obtain this error message :
>
> Request Method:POST
>   Request URL:http://127.0.0.1:8080/publier-media/1/
>   Exception Type: TypeError
>   Exception Value: string indices must be integers
>   Exception Location:
> /usr/lib/python2.4/site-packages/Django-0.90-py2.4.egg/django/core/validators.py
> in isValidImage, line 144
>
> A link to the function :
> http://code.djangoproject.com/browser/django/trunk/django/core/validators.py#l144
>
> I have already lost days on this issue. Some help will be appreciated.
> 
> Thx
> 
> Batiste

Reply via email to