convenience/cdf_meta_analogous_queries
2024-07-03 15:21:38 +03:00

29 lines
603 B
Plaintext

1 model
Journal
refereed
2 model
Article
doctype
journal
Journal.objects.values('refereed').annotate(co_ref=Count('id', distinct=True), co_doctypes=Count('articles__doctype', distinct=True))
Journal.objects.values('articles__doctype', 'refereed').annotate(doc_counts=Count('articles__doctype'))
1 model
File
experiment
2 model
FileAttribute
title
file
File.objects.values('experiment').annotate(co_exp=Count('id', distinct=True), co_titles=Count('attributes__title', distinct=True))
File.objects.values('attributes__title, 'experiment').annotate(title_counts=Count('attributes__title'))