diff --git a/bookmarks/admin.py b/bookmarks/admin.py index 532c1a9..ca6423a 100644 --- a/bookmarks/admin.py +++ b/bookmarks/admin.py @@ -200,9 +200,13 @@ class AdminBookmark(admin.ModelAdmin): class AdminBookmarkAsset(admin.ModelAdmin): - list_display = ("display_name", "date_created", "status") + @admin.display(description="Display Name") + def custom_display_name(self, obj): + return str(obj) + + list_display = ("custom_display_name", "date_created", "status") search_fields = ( - "display_name", + "custom_display_name", "file", ) list_filter = ("status",) diff --git a/bookmarks/models.py b/bookmarks/models.py index 9087829..96bbb1f 100644 --- a/bookmarks/models.py +++ b/bookmarks/models.py @@ -118,6 +118,9 @@ class BookmarkAsset(models.Model): pass super().save(*args, **kwargs) + def __str__(self): + return self.display_name or f"Bookmark Asset #{self.pk}" + @receiver(post_delete, sender=BookmarkAsset) def bookmark_asset_deleted(sender, instance, **kwargs):