0

models.py

class Banner(models.Model):
    banner_photo = models.ImageField(null=True, blank=True)

As the answer below, I would like to preview the image selection before saving the banner image in django-admin. I am a beginner about HTml. How do I override it?

I want to preview the banner picture to be registered with Admin like the captured image. I don't know how to apply it even if I see the answer.

onchange file input change img src and change image color enter image description here

pydjango
  • 37
  • 8
  • I don't believe this is a `Django` question. Given its client-side I'd argue its more `HTML` & `JS`. – PacketLoss Apr 12 '21 at 05:28
  • Does this answer your question? [HTML - Display image after selecting filename](https://stackoverflow.com/questions/12368910/html-display-image-after-selecting-filename) – PacketLoss Apr 12 '21 at 05:28
  • @PacketLoss I want to preview when registering images in django admin, but I knew that I should use HTML & JS when I search on Google. But I don't know HTML & JS well, so I asked how to apply it to django. thank you for your answer. – pydjango Apr 12 '21 at 05:36
  • 1
    Modify the html template for the page you wish to do this on. https://realpython.com/customize-django-admin-python/#overriding-django-admin-templates – PacketLoss Apr 12 '21 at 05:38

0 Answers0