Monday, May 31, 2021

SVG widget for the Admin

I collect the svg source for an image from a public API and store it in
a models.TextField. I have no difficulty displaying it in a normal view
and my own template. Nothing special, it just emerges. I don't even need
a 'safe' filter.

However, I really want to display such images in the Admin. At this
stage all it displays is the svg source.

What is the correct way to make the image appear in the Admin?

Do I need a special field inheriting from TextField? Do I need a special
widget? Is there a way to mark admin field values as safe?

Thanks for any hints

Mike

--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b8ec5d1f-950f-c3cf-2490-e52e75035660%40dewhirst.com.au.

No comments:

Post a Comment