class ImageAdmin(MediaAdmin): roles_accepted = ('admin', 'editor') column_list = ('title', 'path', 'thumb', 'published') form_columns = ['title', 'slug', 'path', 'channel', 'summary', 'published'] def _list_thumbnail(view, context, model, name): if not model.path: return '' return Markup( '<img src="%s">' % url_for( 'media', filename="{0}".format(form.thumbgen_filename( model.path)) ) ) column_formatters = { 'thumb': _list_thumbnail } form_extra_fields = { 'path': ImageUploadField( 'Image', base_path=lazy_media_path(), thumbnail_size=(100, 100, True), endpoint="media", namegen=dated_path, permission=0o777, allowed_extensions="MEDIA_IMAGE_ALLOWED_EXTENSIONS", ) }
class ImageAdmin(MediaAdmin): roles_accepted = ('admin', 'editor', 'author') column_list = ('title', 'full_path', 'thumb', 'published') form_columns = ['title', 'slug', 'path', 'channel', 'content_format', 'comments_enabled', 'summary', 'published'] column_formatters = { 'thumb': _list_thumbnail } form_extra_fields = { 'path': ImageUploadField( 'Image', base_path=lazy_media_path(), thumbnail_size=get_setting_value('MEDIA_IMAGE_THUMB_SIZE', default=(200, 200, True)), endpoint="quokka.core.media", namegen=dated_path, permission=0o777, allowed_extensions="MEDIA_IMAGE_ALLOWED_EXTENSIONS", ) } form_ajax_refs = { 'channel': AjaxModelLoader( 'channel', Channel, fields=['title', 'slug', 'long_slug'], filters={"long_slug__startswith": "media/image"} ) }
class ImageAdmin(MediaAdmin): roles_accepted = ('admin', 'editor', 'author') column_list = ('title', 'path', 'thumb', 'published') form_columns = ['title', 'slug', 'path', 'channel', 'content_format', 'comments_enabled', 'summary', 'published'] def _list_thumbnail(self, context, model, name): if not model.path: return '' return Markup( '<img src="%s" width="100">' % url_for( 'media', filename=form.thumbgen_filename(model.path) ) ) column_formatters = { 'thumb': _list_thumbnail } form_extra_fields = { 'path': ImageUploadField( 'Image', base_path=lazy_media_path(), thumbnail_size=get_setting_value('MEDIA_IMAGE_THUMB_SIZE', default=(200, 200, True)), endpoint="media", namegen=dated_path, permission=0o777, allowed_extensions="MEDIA_IMAGE_ALLOWED_EXTENSIONS", ) } form_ajax_refs = { 'channel': AjaxModelLoader( 'channel', Channel, fields=['title', 'slug', 'long_slug'], filters={"long_slug__startswith": "media/image"} ) }