Queries nested in Django

0

Good afternoon I need an example of nested queries in Django 1.11 using OuterRef(OuterRef('pk'))

Thanks in advance

    
asked by Edilmerio 29.07.2017 в 23:53
source

1 answer

0

It's like any other function, queries return objects and / or collections (lists, dictionaries ...) to be manipulated afterwards.

An example I can give you is this:

consulta_total = Augment_Skill.objects.all().filter(type=Augment_Type.objects.get(id=1))

consulta_total is the variable where I will host the nested query after being called.

Augment_Type.objects.get(id=1) This in itself is a query; I'm telling you to bring me the Object with id 1 from table Augment_Type

That query is inside:

Augment_Skill.objects.all().filter(type=/* CONSULTA_INTERNA */)

Django offers implicit these consultations but that is another issue.

I hope I was clear.

    
answered by 30.07.2017 в 05:46