model:
class Car(models.Model):
...
class CarInstance(models.Model):
car = models.ForeignKey(Car)
Isn’t posible to use one queryset inside another?
Like:
data1 = Car.objects.filter(id__in = [1,3,6])
data2 = CarInstance.objects.filter(car = data1)
I need to use both queryset objects in the future. And Car can have a few CarInstance objects. I think isn’t possible to unite in one queryset like data2__data1.
And cycle like:
car_list = []
for i in data1:
car_list.append(i.id)
data2 = CarInstance.objects.filter(car__in = car_list)
looks ineffective. Thanks.
It looks like you want to do this