mirror of
https://github.com/sissbruecker/linkding
synced 2024-11-24 20:33:04 +00:00
Show proper name for bookmark assets in admin (#708)
This commit is contained in:
parent
9dc3521d5e
commit
0586983602
2 changed files with 9 additions and 2 deletions
|
@ -200,9 +200,13 @@ class AdminBookmark(admin.ModelAdmin):
|
||||||
|
|
||||||
|
|
||||||
class AdminBookmarkAsset(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 = (
|
search_fields = (
|
||||||
"display_name",
|
"custom_display_name",
|
||||||
"file",
|
"file",
|
||||||
)
|
)
|
||||||
list_filter = ("status",)
|
list_filter = ("status",)
|
||||||
|
|
|
@ -118,6 +118,9 @@ class BookmarkAsset(models.Model):
|
||||||
pass
|
pass
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.display_name or f"Bookmark Asset #{self.pk}"
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_delete, sender=BookmarkAsset)
|
@receiver(post_delete, sender=BookmarkAsset)
|
||||||
def bookmark_asset_deleted(sender, instance, **kwargs):
|
def bookmark_asset_deleted(sender, instance, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue