image display in admin

54 views
Skip to first unread message

Harjot Mann

unread,
Oct 6, 2013, 8:27:33 AM10/6/13
to django...@googlegroups.com
I am uploading an image in my app and I want to display that image in
admin site. What should I do?
--
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

Gabriel - Iulian Dumbrava

unread,
Oct 6, 2013, 11:05:34 AM10/6/13
to django...@googlegroups.com
Add a property to your model that returns the img tag you want, set it to allow html content, then add the property to list_display in your admin.py.

Harjot Mann

unread,
Oct 6, 2013, 11:14:09 AM10/6/13
to django...@googlegroups.com
On Sun, Oct 6, 2013 at 8:35 PM, Gabriel - Iulian Dumbrava
<gabriel....@gmail.com> wrote:
> Add a property to your model that returns the img tag you want, set it to allow html content, then add the property to list_display in your admin.py.


Done but it is not displaying anything.:(
I used thumbnails but its still behaving same. What to do?

Gabriel - Iulian Dumbrava

unread,
Oct 6, 2013, 11:32:22 AM10/6/13
to django...@googlegroups.com
Add a property that should retain a dummy text and try to display that. If that works change the dummy text with img, then look at the source page generated by the admin.

Maybe the image url is not correctly set and some browsers don't show the img placeholder if the src is wrong.

Harjot Mann

unread,
Oct 6, 2013, 12:49:04 PM10/6/13
to django...@googlegroups.com
I am doing it like this:
http://tny.cz/26ed40cd

Harjot Mann

unread,
Oct 6, 2013, 1:18:10 PM10/6/13
to django...@googlegroups.com
Should I need to give the media_root and media_url path?

Harjot Mann

unread,
Oct 7, 2013, 12:24:54 AM10/7/13
to django...@googlegroups.com
On Sun, Oct 6, 2013 at 5:57 PM, Harjot Mann <harjotm...@gmail.com> wrote:
> I am uploading an image in my app and I want to display that image in
> admin site. What should I do?


http://www.acedevs.com/blog/2011/07/11/django-admin-list-view-thumbnails/
I followed this link but it does not work. Help me please.

Alban Hertroys

unread,
Oct 7, 2013, 6:15:09 AM10/7/13
to django...@googlegroups.com
On Monday, October 7, 2013 6:24:54 AM UTC+2, Harjot Mann wrote:
On Sun, Oct 6, 2013 at 5:57 PM, Harjot Mann <harjotm...@gmail.com> wrote:
> I am uploading an image in my app and I want to display that image in
> admin site. What should I do?


http://www.acedevs.com/blog/2011/07/11/django-admin-list-view-thumbnails/
I followed this link but it does not work. Help me please.

Apparently you missed something, but you only showed a tiny bit of the relevant code. That, or that example is sufficiently outdated that it no longer works like that (It is 2 years old).

Did you add 'slide_thumbnail' to your list_display set? Did you register your custom Admin class? Did you remove the pyc file?
Reply all
Reply to author
Forward
0 new messages