Skip to content

Instantly share code, notes, and snippets.

@fhdez
Created July 5, 2018 22:35
Show Gist options
  • Save fhdez/242f9876c429ad90b92e55894e958d55 to your computer and use it in GitHub Desktop.
Save fhdez/242f9876c429ad90b92e55894e958d55 to your computer and use it in GitHub Desktop.
#usuarios - alumnos a los que se les mando el mensaje
hijos = ReceiverMessage.objects.filter(message_id=52).values_list('user__email', flat=True)
#extraer el padre por el email de los hijos, salio none
for u in User.objects.filter(email__in=hijos):
print u.parent, u.children
#la forma para traer a los hijos - email, que se mando fue con:
for u in User.objects.filter(children__email__in=hijos):
print u.email, u.children.all().values_list('email', flat=True)
for r in ReceiverMessage.objects.filter(user__email='[email protected]'):
print r.message_id, r.was_read, r.user.children.all().values_list('email', flat=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment