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.
我想将记录分为两类:
我该怎么做?我正在考虑使用 annotate()。
q = Book.objects.annotate(num_authors=Count('authors')) books_with_3_or_over_authors = q.filter(num_authors__gte=3) books_with_less_than_3_authors = q.filter(num_authors__lt=3)