Answer the question
In order to leave comments, you need to log in
How to make (and output) an image from text in django?
For example, I have an article model. It has fields: title(CharField), thumbnail(ImageField, blank=True). When the user does not want to upload a picture, it is necessary to create a picture with the title of the article. If it is not clear, you can see the illustration:
Is it possible to implement this? Z.Y. pay no attention to what is written below. This is for clarity.
Answer the question
In order to leave comments, you need to log in
Maybe. Hang up a pre_save signal to save the article, check in the signal handler that the image field is not set, get the title text, use Pillow to create a picture and assign the image field.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question