I have word
model and phrase
model
class Word(models.Model):
checked = models.BooleanField(default=False)
class Phrase(models.Model):
words = models.ManyToManyField(Word, null=True,related_name = "phrases")
Word
model has attribute checked
and many to many connection to phrase
I need to perfom a difficult for me query:
We are considering that phrase
is checked
if it has at least onechecked
word.How do I find all words that has only checked phrases and doesn't have
unchecked
phrases?
Right now I am doing using cycle through all words in db, but this is not very effective, so I am looking for more efficient way to do this.