Fix a small regression in the admin introduced with Django 6

This commit is contained in:
2026-01-08 12:21:39 +01:00
parent a16801eb4b
commit ab606859d1
2 changed files with 15 additions and 6 deletions

View File

@@ -2,7 +2,12 @@ import html
from django.conf import settings
from django.contrib import admin
from django.utils.html import format_html, format_html_join, strip_tags
from django.utils.html import (
format_html,
format_html_join,
strip_tags,
mark_safe,
)
from adminsortable2.admin import SortableAdminBase, SortableInlineAdminMixin
from ram.admin import publish, unpublish
@@ -149,7 +154,7 @@ class BookAdmin(SortableAdminBase, admin.ModelAdmin):
def invoices(self, obj):
if obj.invoice.exists():
html = format_html_join(
"<br>",
mark_safe("<br>"),
'<a href="{}" target="_blank">{}</a>',
((i.file.url, i) for i in obj.invoice.all()),
)
@@ -317,7 +322,7 @@ class CatalogAdmin(SortableAdminBase, admin.ModelAdmin):
def invoices(self, obj):
if obj.invoice.exists():
html = format_html_join(
"<br>",
mark_safe("<br>"),
'<a href="{}" target="_blank">{}</a>',
((i.file.url, i) for i in obj.invoice.all()),
)

View File

@@ -2,8 +2,12 @@ import html
from django.conf import settings
from django.contrib import admin
from django.utils.html import format_html, format_html_join, strip_tags
from django.utils.html import (
format_html,
format_html_join,
strip_tags,
mark_safe,
)
from adminsortable2.admin import SortableAdminBase, SortableInlineAdminMixin
from ram.utils import generate_csv
@@ -229,7 +233,7 @@ class RollingStockAdmin(SortableAdminBase, admin.ModelAdmin):
def invoices(self, obj):
if obj.invoice.exists():
html = format_html_join(
"<br>",
mark_safe("<br>"),
'<a href="{}" target="_blank">{}</a>',
((i.file.url, i) for i in obj.invoice.all()),
)