Mode.objects.filter(somefield__in=[1,2,3]).values_list('id', flat=True)
What I get are objects of qs in the list: [<queryset [6]>, <queryset [3]>, <queryset [4]>, <queryset [12]>]</queryset></queryset></queryset></queryset>
even if I'm putting it in list using list(). # Select all objects load for the date
loads = Load.objects.filter(date=datetime.now())
# the for loop loads in each iteration even cycle with obtaining values for rent_id
[i.values_list('rent_id', flat=True) \
for i in [load.loadpara_set.all() for load in loads] if i]
list(LoadPara.objects.filter(load__date=datetime.now().date()).values_list('rent_id', flat=True))
Find more questions by tags Django
rent_id is a FK to another model, it won't change anything. There is nothing non-standard. Django Version 1.11. I understand why he gives a list from a queryset, but how to turn it into a list of net id? Your code does not work, mentioned in the question about it. - Candida93 commented on June 14th 19 at 18:29
LoadPara.filter(load__date=datetime.now()).values_list('rent_id', flat=True) - Willow17 commented on June 14th 19 at 18:32
and then begins the recovery nuzhnyy data from each set. But you, as I write, it makes a lot of queries in a loop. I do want to ask a separate question on this topic, because often we have to do. This is mainly used for validation, because I need to check something in all instances. In this, I'm doing loops, and generally all of these procedures. - Candida93 commented on June 14th 19 at 18:35