from django.contrib.admin.templatetags.admin_list import items_for_result, result_headers from django.template import Library from django.utils.safestring import mark_safe register = Library() def results(cl, additional_links): """ Rewrite of original function to add additional columns after each result in the change list. """ for res in cl.result_list: rl = list(items_for_result(cl,res)) for link in additional_links: rl.append(mark_safe(link['url_template'] % res.id)) yield rl def extended_result_list(cl, additional_links): """ Rewrite of original function to add an additional columns after each result in the change list. """ headers = list(result_headers(cl)) for header in additional_links: headers.append(header) return { 'cl': cl, 'result_headers': headers, 'results': list(results(cl, additional_links)) } # This function is an example template tag for use in an overridden change_list.html template. def person_result_list(cl): additional_links = ( { 'text': 'All Registrations', 'sortable': False, 'url_template': '