L
L
lemonchik372021-11-10 05:59:49
Django
lemonchik37, 2021-11-10 05:59:49

How to tell the admin panel to skip only gif files from images?

I want to make a site only for giveaways and so that if the user uploads a new image, he will get an error like "the file of this format is not suitable"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Python Newbie, 2021-11-10
@Levman5

When a user uploads a file, check its format and if it doesn't fit send an exception: Don't forget to import: It's all in the admin.py file PS. I don’t understand Django myself (I did several projects on vidos), but I know about it. Try raise ValidationError('Текст сообщения')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question