Combining Lookups

Report a typo

You have an Engine model with type and volume fields, and a Car model with color, engine, and speed fields:

class Engine(models.Model):
    type = models.CharField(max_length=32)
    volume = models.IntegerField()


class Car(models.Model):
    color = models.CharField(max_length=32)
    engine = models.ForeignKey(Engine, on_delete=models.CASCADE)
    speed = models.FloatField()

Filter cars which have the "vee" type of engine with a volume less than or equal to 300. The result should be a QuerySet object.

Write a program in Python 3
vee_engine_cars = ...
___

Create a free account to access the full topic