revert column header to user, truncate notes

This commit is contained in:
Rachid Mrad 2024-01-19 15:22:42 -05:00
parent 510da21934
commit d1a80d3307
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF

View file

@ -1240,7 +1240,7 @@ class DraftDomainAdmin(ListHeaderAdmin):
class VeryImportantPersonAdmin(ListHeaderAdmin): class VeryImportantPersonAdmin(ListHeaderAdmin):
list_display = ("email", "custom_user_label", "notes", "created_at") list_display = ("email", "user", "truncated_notes", "created_at")
search_fields = ["email"] search_fields = ["email"]
search_help_text = "Search by email." search_help_text = "Search by email."
list_filter = [ list_filter = [
@ -1250,10 +1250,11 @@ class VeryImportantPersonAdmin(ListHeaderAdmin):
"user", "user",
] ]
def custom_user_label(self, obj): def truncated_notes(self, obj):
return obj.user # Truncate the 'notes' field to 200 characters
return str(obj.notes)[:50]
custom_user_label.short_description = "Requestor" # type: ignore truncated_notes.short_description = "Notes (Truncated)" # type: ignore
def save_model(self, request, obj, form, change): def save_model(self, request, obj, form, change):
# Set the user field to the current admin user # Set the user field to the current admin user