mediafile thumbnail in page admin

28 views
Skip to first unread message

monty

unread,
Apr 27, 2012, 12:58:09 AM4/27/12
to Django FeinCMS
I have a custom model representing a collection of banner images to be
shown in a slideshow. I was able to get the Page admin to allow the
user to select multiple images with the code below. The problem I'm
having is that when the user selects an image, the foreign key of the
image is shown in a text box in a comma delimited format.

Does anyone know how to make a thumbnail of the image appear in the
Page admin also?

The relevant code is below:

from django.template.loader import render_to_string
from feincms.module.page.models import Page
from feincms.admin.item_editor import FeinCMSInline

class BannerImages(models.Model):
images = models.ManyToManyField(MediaFile)

class feincms_item_editor_inline(FeinCMSInline):
raw_id_fields = ('images',)

class Meta:
abstract = True

def render(self, **kwargs):
return render_to_string('main/banner_images.html', {'model':
self})

feincms_config.Page.create_content_type(BannerImages)

Thank You!
Reply all
Reply to author
Forward
0 new messages