Anybody please help.

On Sun, Mar 22, 2015 at 3:07 PM, Sandeep kaur <mkaurkha...@gmail.com> wrote:

> Greetings,
> I want to have the thumnails of images with the names in the dropdown
> field of form. To return the image as foreign key field, I have used  this
> code :
> def __unicode__(self):
>         image_data =
> open("/home/sandy/whats-fresh-api/media/images/download.jpg", "rb").read()
>         return '%s' % (self.name) + HttpResponse(image_data,
> content_type="image/jpg")
>
> But it give following error :
> Exception Value:
>
> coercing to Unicode: need string or buffer, HttpResponse found
>
>
> Is it possible to do this ?
>
> Thanks.
>
> --
> Sandeep Kaur
> Blog: sandymadaan.wordpress.com
> SCM: https://github.com/sandeepmadaan
>
>
>
>


-- 
Sandeep Kaur
Blog: sandymadaan.wordpress.com
SCM: https://github.com/sandeepmadaan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF66xG00kpdSJqW-2D7W_HYR4e%3DVEeW3E81KMHBoU-OhDbUFNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to