Q:

Django admin TabularInline - is there a good way of adding a custom html column? 

I've got a model (Entry) which contains a simple property:
@property
def image(self):
        return str(self.id)+"_"+self.round.season.name+"_"+self.round.theme+"_"+self.person.name

I use this to build the name of a particular image file on disk.  So I know that there's going to be an image at /path/to/images/(model.image()).jpg
I can display the raw image property itself within the TabularInline layout on an admin page by adding it to the readonly_fields collection, but how would I go about getting a column which had custom html wrapped around the model property? 
e.g.
<img src="/images/{{model.image}}.jpg" />

A:

What you can do is create a method in your TabularInline subclass that returns the HTML you want, then use that method's name in place of image in ImageInline.fields:
from django.utils.safestring import mark_safe

class ImageInline(admin. TabularInline):
    ...
    fields = (..., 'render_image')
    readonly_fields = (..., 'render_image')

    def render_image(self, obj):
        return mark_safe("""<img src="/images/%s.jpg" />""" % obj.image)

A:

According to current Django 1.2+ I got errors "Form does not have such field as render_image".  Solution is simple put the render_image function into model. Admin not in your inline form, second thing is fields and readonly_fields settings in your Inline form... So here You have what I've ended up with:
class OfferPropertyInline(admin. TabularInline):
    model = OfferProperty
    fields=('property_value',)
    readonly_fields = ('property_value',)

class OfferAdmin(admin. ModelAdmin):
    inlines = [
        OfferPropertyInline
    ]

    def property_value(self,obj):
        return obj.get_value()

admin.site.register(Offer, OfferAdmin)

