A
A
Alex Xmel2020-05-06 15:32:14
Django
Alex Xmel, 2020-05-06 15:32:14

Why does the title of the image change?

There is a simple model with this field:

class PaySystemModel(models.Model):
    url = models.FileField(blank=True, verbose_name='Изображение', upload_to='static/img')


When I select an image for this field in the standard admin panel, it pulls up, works fine, no complaints, but a copy of the image is automatically created with the addition of a random suffix. If there was, for example, Qiwi.png, then something like QIWI_9MDeJ4P.png will become.
If I remove the upload_to item, then everything also works fine, while it is not renamed, but Django transfers all the pictures to the project root, which is not very convenient. I would like to leave the pictures on the static / img path and at the same time without auto-renaming. How to do it?

ps ImageField did not use because according to the docks, this is almost the same thing, but for the ImageField, you also need to install Pillow. I just didn't want to put additions because of such a simple task.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2020-05-06
Matytsyn @ArsenyMatytsyn

When duplicating an image, a new one is automatically created with this kind of code. Check if you are trying to re-upload the image.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question