0
I’m using Python with the Django framework. This method must return a resulting query, to send e-mail to the corresponding emails from the database. However, the method works for some cases and for others not.
from django.db.models import Q
def membrosBancaAtual(semestre):
semestre = semestre.filter(atual = True)
disciplina = Disciplina.objects.filter(semestre = semestre)
projetos = ProjetoDeGraduacao.objects.filter(disciplina__in = disciplina)
query = Q(banca2__in = projetos)
return query
Does anyone have any idea why some cases work and others do not?
query = Q(banca2__in=projetos)
wasn’t supposed to be inside aModel.objects.filter()
?– Paulo
What do you mean? Can you give an example? I did other functions similar to this one, all had this type and worked when I tested it.
– Bruno Derisso Salvini
You want to send emails to the banking members, you should return the membership list, you’re just returned
Q(banca2__in=projetos)
.– Paulo
But why to an e-mail and not to others? And I also did other methods like this, changing only the "query" line and it worked when I tested, sent the emails. What list of members do you refer to? I’ve been filtering the query with the other variables.
– Bruno Derisso Salvini