Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Django 应用程序中有两个模型:
class Animal(models.Model): ... class Pet(Animal): ...
我想选择所有Animals,但不包括Pets。我该怎么做?
Animal
Pet
尝试:
Animal.objects.filter(pet=None)
假设这Animal不是一个抽象模型。