[Answered ]-Django ManyToMany Field admin display highest value

1👍

You can annotate the QuerySet with the highest degree, and then define a method that will render that maximum:

from django.db.models import Max

class MyModelAdmin(admin.ModelAdmin):
    list_display = ['lastname', 'firstname', 'max_degree']

    def get_queryset(self, request):
        queryset = super().get_queryset(request).annotate(
            max_degree=Max('degree__rank')
        )

    def max_degree(self, obj):
        return obj.max_degree

Leave a comment