aljosa/django-tinymce — pull request #32 by dokterbob (2012-02-16 09:48:17+00:00)
Title: Django Admin mixins for dynamic TinyMCE link and image lists

I produced Django Admin Mixin classes which allow for simple, easy and dynamic link and image lists within the editor. It also allows for easy and dynamic configuration of the fields for which TinyMCE should be used.

Example usage:

class BananaAdmin(TinyMCEAdminListMixin, TinyMCEImageListMixin):
model = Banana

tinymce_fields = ('description', )

related_image_field = 'image'
related_image_size = '200x300'

def get_related_images(cls, request, obj):
return obj.bananaimage_set.all()

def get_image_list_url(self, request, field, obj=None):
if obj:
return reverse('admin:banana_image_list', \
args=(obj.pk, ))
else:
return None

(Yes, I would like to make the `get_image_list_url` default to the `get_image_list_url`-function above - as it only has to be overridden in case you want to use images/links on inline admin objects using images/links from the parent object - but I have no time to do proper test it and don't want to bother you with untested stuff.)