I want to know how I can display the highest ranking from the model education in the staff. The user would be able to select all of their educations, but for me it's irrelevant to know if the the user selected "high school" when he/she also has a master's degree.
class Staff(models.Model):
education = models.ManyToManyField('Education', verbose_name = 'Education')
class Education(models.Model):
name = models.CharField(max_length = 200, blank = False)
rank = models.PositiveIntegerField(default = 0)
def __str__(self):
return self.name
I gave every type of education a ranking.
So in the Admin, the only thing I want returned would be the highest eduacation by a member of the staff - how do I write this function?
class StaffAdmin(admin.ModelAdmin):
list_display = ('rank', )