I have the following model:
class Administrator(models.Model):
// code
def __str__(self):
title = 'Administrator ' + str(self.pk)
return title
This returns titles for the objects as Administrator 1, Administrator 2, etc.
How do I return the title in list_display for a ModelAdmin?:
class AdministratorAdmin(ModelAdmin):
model = Administrator
list_display = ('pk', 'id', 'title???')
I think it should be:
class AdministratorAdmin(ModelAdmin):
model = Administrator
list_display = ('pk', 'id', '__str__')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With