Opened 17 years ago

Closed 14 years ago

Last modified 11 years ago

#5476 closed Uncategorized (wontfix)

Image thumbnails on image fields in the admin

Reported by: rich@… Owned by: xian
Component: contrib.admin Version: dev
Severity: Normal Keywords: nfa-someday admin, thumbnails imagefields
Cc: jdunck+django@… Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I think it would be pretty nifty if the newforms-admin could render image thumbnails on image upload fields. It's a snippet but why do more when forms are already getting jazzed up and it goes a long way in usability? http://www.djangosnippets.org/snippets/239/

Attachments (3)

image-preview-in-admin.patch (2.6 KB ) - added by vitja 16 years ago.
preview image on model admin page
image-preview-in-admin.diff (2.6 KB ) - added by vitja 16 years ago.
preview image on model admin page
thumbnail-field-and-example.py (2.5 KB ) - added by vitja 16 years ago.
thumbnail field

Download all attachments as: .zip

Change History (17)

comment:1 by Julian Bez, 17 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by deepak <deep.thukral@…>, 17 years ago

For the sake of simplicity -1 from me. Django shouldn't require any external package forcibly.

in reply to:  2 comment:3 by James Bennett, 17 years ago

Replying to deepak <deep.thukral@gmail.com>:

For the sake of simplicity -1 from me. Django shouldn't require any external package forcibly.

Django's ImageField already requires PIL, so this wouldn't change anything. Similarly, XMLField requires Jing, memcached caching requires the memcached bindings and using a database (except SQLite when using Python 2.5) requires a database adapter module.

comment:4 by James Bennett, 17 years ago

See also #4115 and #961.

comment:5 by xian, 17 years ago

Keywords: admin thumbnails imagefields added
Owner: changed from nobody to xian
Version: SVNnewforms-admin

Assigning this to myself and moving to newforms-admin. As I'm doing newforms-admin interface work. :)

I'd like to see thumbnails for imagefields in both the change_list and the form itself if there is already an image set. However this only makes sense to do if #4115 happens. And if it does it should happen in templates/templatetags for the admin not in the model as in the linked-to snippet.

comment:6 by anonymous, 17 years ago

Cc: jdunck+django@… added

comment:7 by Brian Rosner, 17 years ago

Keywords: nfa-someday added

This functionality is not critical before the merge to trunk. Tagging with nfa-someday.

by vitja, 16 years ago

preview image on model admin page

comment:8 by vitja, 16 years ago

Hi!

I've recently attached patch, that shows image on admin page:

image = models.ImageField(admin_preview=True)

I'm going to create generic way of creating thumbnails, so could you give me a tip.
I think that should be field, e.g.

image_thumb = ImageThumbField(thumb_for='image', thumbnalizer=create_100x100_thumb)

so adding thumbs to list_view will be as easy as:

def get_thumb(self):
    return '<img src="%s" />' % self.get_thumb_url
get_thumbs.allow_tags=True

or even:

@image_tag_for('thumb')
def get_thumb():
    pass

by vitja, 16 years ago

Attachment: image-preview-in-admin.diff added

preview image on model admin page

by vitja, 16 years ago

thumbnail field

comment:9 by Alex Gaynor, 16 years ago

Version: newforms-adminSVN

comment:10 by Flo Ledermann, 16 years ago

This snippet is a much better starting point:

http://www.djangosnippets.org/snippets/934/

I just looked around in the source files and I think it cannot be done with template work alone, but one has to create an ImageWidget for the admin like in the snippet. I got this code working on my site in a few minutes and I think this would be a good basis for a patch. It only depends on PIL but degrades gracefully if not present.

Is there anything I can do to help (I have not yet contributed to Django code, so would need some guidance)

comment:11 by Malcolm Tredinnick, 14 years ago

Resolution: wontfix
Status: newclosed

There seem to be too many variable preferences required here for how the thumbnail display would work. It's a lot of complexity to put it into the admin by default. Fortunately, it's possible without modifying Django for individual apps: specify a model form on the ModelAdmin subclass and a widget for that field that is the custom widget that display the thumbnail.

comment:12 by anonymous, 12 years ago

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

comment:13 by anonymous, 11 years ago

@mtredinnick It's easy to say "it's easy"; it's harder (though not all that much) to actually provide documentation and example code so that a non-Django-expert can understand how to add thumbnails to their admin.

In other words, you can quibble over whether or not thumbnail support should be built in to Django, but you can't argue with the fact that right now it's more difficult than it needs to be for someone to have thumbnails in their admin. If it's not going to be built in, it would benefit Django to have some explanation of the non-built-in way of doing thumbnails.

comment:14 by Russell Keith-Magee, 11 years ago

Firstly - It's worth pointing out that @mtredinnick is deceased.

Secondly, you've apparently missed the point of what he was saying -- there isn't a single, obvious way to do this. It would be impossible for Django to document how it could be done without "blessing" a particular approach. This would almost certainly involve blessing one of the third-party thumbnailing libraries, (sorl-thumbnails and easy-thumbnails to pick just two).

More broadly, as a project, we have an open problem of helping newcomers find appropriate third-party tools in the Django ecosystem. However, I don't think we can address that problem by documenting examples that use selected packages.

Note: See TracTickets for help on using tickets.
Back to Top