Is it possible, within a single Django admin model, to aggregate fields from related objects.
For example, I have a Student Object that has a FK to a Test Object. The test object has a "score" field.
Can I aggregate the scores across all Student's Tests and place it in the admin display_list attribute?
You can, for example:
However, AFAIK, you cannot click sort within the admin on these fields via this method, as addingnum_fixture_metas
from.annotate()
to thelist_display
results in a missing field error.https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display https://docs.djangoproject.com/en/dev/topics/db/aggregation/