How can I find an image, depending on the text?
I have image model with keywords:
class Post(models.Model):
image = ImageField(_('Image'), blank=True, upload_to='folder')
keywords = models.CharField(_('Keywords'), max_length=80)
And model which will serve as the search for a suitable image
class TextSearch(models.Model):
body = models.TextField(_('Text'))
Are you looking for something like this?
This will give you every
Postwith theTextSearch‘sbodyin thekeywords. If that’s not what you want, you might want to check here for a full list of Django’s QuerySet methods.