django-imagekit icon indicating copy to clipboard operation
django-imagekit copied to clipboard

admin thumbnail template rendering with <br/>

Open gabbork opened this issue 12 years ago • 4 comments

hi, when using AdminThumbnail to render thumbs preview in admin (inline in my case), if using default template https://github.com/matthewwithanm/django-imagekit/blob/develop/imagekit/templates/imagekit/admin/thumbnail.html each line is rendered with a < br / > tag (that brakes the layout)

To have the correct rendering I have to provide a all in one line template like this:

{% if thumbnail %}<a href="{{ model.get_absolute_url|default:original_image.url }}"><img src="{{ thumbnail.url }}"></a>{% endif %}

I don't know if I do something incorrect... thanks

gabbork avatar Aug 31 '13 11:08 gabbork

That's odd! Can you share your admin class? Also, which version of Django are you using?

matthewwithanm avatar Sep 01 '13 21:09 matthewwithanm

I have this problem too – Django is version 1.5.4, freshly installed in a virtualenv.

fish2000 avatar Oct 04 '13 10:10 fish2000

@fish2000 Very strange. I can't reproduce this. Can you share the admin class?

matthewwithanm avatar Oct 06 '13 18:10 matthewwithanm

the same for me. Looks like render_to_string() do it wrong. Latest imagekit from pip Django 1.6

class PhotoAdmin(admin.ModelAdmin):
    list_display = ('title', 'admin_thumbnail')
    readonly_fields = ('admin_thumbnail',)
    admin_thumbnail = AdminThumbnail(
        image_field='thumbnail_s220',
        template='admin/thumbnail.html',
    )

    fieldsets = (
        ('', {
            'classes': ['wide', 'extrapretty'],
            'fields': ('gallery', 'title', 'original', 'admin_thumbnail',
                       'sort', 'is_public'),
        }),
    )

alternativshik avatar Jan 30 '14 12:01 alternativshik