BO 1.25 App Texts + picture

This commit is contained in:
Tibor Bossanyi (Freelancer) 2021-09-09 07:54:41 +02:00
parent 925c35f329
commit 3bef573f82

View File

@ -13,11 +13,11 @@ class TranslationAppTextInline(admin.TabularInline):
class AppTextAdmin(admin.ModelAdmin):
list_display = ('text_key','checked')
fields = ('text_key','screenshot_url', 'checked')
fields = ('text_key','screenshot_url', 'checked', "get_image_preview")
readonly_fields = ("get_image_preview",)
def get_image_preview(self, obj):
screenshot_url = '/media/' + str(obj.url)
screenshot_url = '/media/' + str(obj.screenshot_url)
if obj.pk:
return format_html('<img src="{url}" title="{url}" width="30%" height="30%"/> ' \
.format(url=screenshot_url))