I want to display text in multiple lines in django admin, but django ignore "\n".
This is what I've got:
I just want to split this text in multiple lines, what is the best way to do it?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With