views:

189

answers:

2

Hello,

I would like to make a custom admin page for one of my application with django. I've created a change_form.html and fieldset.html in admin/myapp/mymodel of my template folder. I am now able to customize the page.

mymodel has an ImageField and I would like to display this image on the page. I guess this is possible because the ImageField shows a link to the image on the page.

I am trying to modify the fieldset.html but unfortunately I don't know how to access the url in order to put in an img html tag. {{field.field.field}} shows an ImageField object but how to access the current value for this field?

Thanks in advance

+1  A: 
<img src="{{field.field.field.url}}"> 

On a related note, instead of having to do all that, you could use django-form-utils that will provide you a thumbnail included display and clear-able file field, for free.

Lakshman Prasad
{{field.field.field.url}} doesn't work for me. See my answer
luc
A: 

The current object can be accessed in a custom django admin template with {{original}}

It solves my problem

luc