7👍
✅
i usually do it like this
from django.utils.html import linebreaks
class SomethingAdmin(admin.ModelAdmin):
list_display = [..., 'admin_get_variants']
def admin_get_variants(self, obj):
return linebreaks(obj.get_variants)
admin_get_variants.short_description = u'Get variants'
admin_get_variants.admin_ordering_field = 'get_variants'
admin_get_variants.allow_tags = True
👤tug
Source:stackexchange.com