mirror of
https://github.com/daniviga/django-ram.git
synced 2025-12-05 13:38:43 +01:00
Extend compatibility with Django 6.0
This commit is contained in:
@@ -2,7 +2,7 @@ import html
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
from django.utils.html import format_html, strip_tags
|
||||
from django.utils.html import format_html, format_html_join, strip_tags
|
||||
|
||||
from adminsortable2.admin import SortableAdminBase, SortableInlineAdminMixin
|
||||
|
||||
@@ -44,7 +44,7 @@ class RollingClass(admin.ModelAdmin):
|
||||
@admin.display(description="Country")
|
||||
def country_flag(self, obj):
|
||||
return format_html(
|
||||
'<img src="{}" /> {}'.format(obj.country.flag, obj.country)
|
||||
'<img src="{}" /> {}', obj.country.flag, obj.country.name
|
||||
)
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ class RollingStockAdmin(SortableAdminBase, admin.ModelAdmin):
|
||||
@admin.display(description="Country")
|
||||
def country_flag(self, obj):
|
||||
return format_html(
|
||||
'<img src="{}" /> {}'.format(obj.country.flag, obj.country)
|
||||
'<img src="{}" /> {}', obj.country.flag, obj.country.name
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
@@ -222,13 +222,14 @@ class RollingStockAdmin(SortableAdminBase, admin.ModelAdmin):
|
||||
@admin.display(description="Invoices")
|
||||
def invoices(self, obj):
|
||||
if obj.invoice.exists():
|
||||
html = "<br>".join(
|
||||
"<a href=\"{}\" target=\"_blank\">{}</a>".format(
|
||||
i.file.url, i
|
||||
) for i in obj.invoice.all())
|
||||
html = format_html_join(
|
||||
"<br>",
|
||||
"<a href=\"{}\" target=\"_blank\">{}</a>",
|
||||
((i.file.url, i) for i in obj.invoice.all())
|
||||
)
|
||||
else:
|
||||
html = "-"
|
||||
return format_html(html)
|
||||
return html
|
||||
|
||||
def download_csv(modeladmin, request, queryset):
|
||||
header = [
|
||||
|
||||
Reference in New Issue
Block a user