Answer the question
In order to leave comments, you need to log in
How to formulate a django orm request?
Hello.
Let's say I have 2 tables: books and genres. They are related in a many-to-many relationship.
class Genre(models.Model):
name = models.CharField(max_length=100)
class Book(models.Model):
genres = models.ManyToManyField(Genre)
genres = ['Комедия', 'Триллер']
books = Book.objects.filter(genres__name__contains=genres) #тут пробовал и in
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question