1👍
Don’t know if this is the best way, but it can be done with template
tags. Here is how I did it:
# <app>/templatetags/erp.py
register = template.Library()
@register.assignment_tag
def erp_get_tasks ():
return Task.objects.exclude (done=True).order_by ('priority')
.
# <app>/templates/admin/erp/app_index.html
{% extends "admin/app_index.html" %}
{% load erp %}
...
{% block footer %}
{% erp_get_tasks as tasks %}
{% for task in tasks %}
...
Source:stackexchange.com