Fix: post title in django admin page

This commit is contained in:
Aroy-Art 2025-03-18 22:28:24 +01:00
parent 9a2759bb21
commit 0cdbccdd6e
Signed by: Aroy
GPG key ID: 583642324A1D2070

View file

@ -52,7 +52,7 @@ class PostAdmin(admin.ModelAdmin):
"post_id",
"source_site",
"creator",
"title",
"title_at",
"description_at",
"mature",
"date_created_fromated",
@ -60,6 +60,14 @@ class PostAdmin(admin.ModelAdmin):
"date_last_import_formated",
]
@admin.display(description="Title")
def title_at(self, obj):
if obj.title.first() is not None:
if len(str(obj.title.first().content)) >= 80:
return obj.title.first().content[:77] + "..."
else:
return obj.title.first().content
@admin.display(description="Description")
def description_at(self, obj):
if len(str(obj.description.first().content)) >= 80: