@register.inclusion_tag('<STR_LIT>' % DINGOS_TEMPLATE_FAMILY,takes_context=True)<EOL>def render_table_ordering(context, index, title):
<EOL>new_context = { '<STR_LIT:title>' : title, '<STR_LIT>' : context['<STR_LIT>'].get_query_string(remove=['<STR_LIT:o>']) }<EOL>new_context['<STR_LIT>'] = new_context['<STR_LIT>'] + '<STR_LIT>' + index<EOL>if '<STR_LIT:o>' in context['<STR_LIT>'].GET and ( context['<STR_LIT>'].GET['<STR_LIT:o>'] == index or context['<STR_LIT>'].GET['<STR_LIT:o>'] == '<STR_LIT>' % index):<EOL><INDENT>new_context['<STR_LIT>'] = new_context['<STR_LIT>'] + '<STR_LIT>' + (index if context['<STR_LIT>'].GET['<STR_LIT:o>'].startswith('<STR_LIT:->') else '<STR_LIT:->' + index) <EOL>new_context['<STR_LIT>'] = '<STR_LIT>' if context['<STR_LIT>'].GET['<STR_LIT:o>'].startswith('<STR_LIT:->') else '<STR_LIT>'<EOL><DEDENT>return new_context<EOL>
Renders a TABLE LAYOUT ordering using given index and a human-readable title for it.
Note that a new context is created for the template (containing only very few elements needed
for displaying).

Usage in template: {% render_table_ordering "model_field__submodel_field" "Human-readable Title" %}