I am using Django admin for my site and I would like to make a customization on how a field is displayed on the list_display page for one of my models.
One of my models has a TextField that can be 300 characters
When the model is listed in the Django admin, I would like to limit the length of the text displayed in the Admin list display to 100 characters.
Is there a way to do this within the Django Admin class?
admin.py:
class ApplicationAdmin(admin.ModelAdmin):
model = Application
list_display = [ "title1", "title2"]
models.py:
class Application(models.Model):
title1 = models.TextField(max_length=300)
title2 = models.TextField(max_length=300)

所有评论(0)