class PreviewAdmin(admin.ModelAdmin): def admin_slide_preview(self, obj): return "
+
" % obj.id admin_slide_preview.allow_tags = True admin_slide_preview.short_description = 'Preview' def get_preview(self, request, object_id): sub = self.queryset(request)[0] template = "preview/%s.html" % sub.__class__.__name__ return object_detail(request, queryset=self.queryset(request), object_id=object_id, template_name=template.lower()) def get_urls(self): urls = super(PreviewAdmin, self).get_urls() my_urls = patterns('', (r'^(?P\d+)/preview/$', self.get_preview), ) return my_urls + urls class Media: js = js = ('js/jquery.js', 'js/jquery.adminpreview.js',) ============== jquery.adminpreview.js $(document).ready(function(){ $(".previewslide").click(function(){ $.ajax({ url:$(this).attr('id'), context: $(this).parent().parent(), success:function(data){ var $html = $(data); $('.previewed').each(function(){ $(this).remove(); }); if(!$html.hasClass('previewed')){ $html.addClass('previewed'); } $html.addClass($(this.context).attr('class')); $(this.context).after($html); } }); }); }); ============== preview/template.html
Abstract:
{{ object.abstract }}
Author: {{ object.author }}
Published: {{ object.published_date }}
Category: {{ object.category }}

Tags: {% for tag in object.get_tags %} {{ tag }} {% if not forloop.last %}, {% endif %} {% endfor %}