Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

m2m_foreign_field aggregate values #117

Open
TITANHACKY opened this issue Jul 18, 2023 · 4 comments
Open

m2m_foreign_field aggregate values #117

TITANHACKY opened this issue Jul 18, 2023 · 4 comments

Comments

@TITANHACKY
Copy link

Currently there is no aggreate values for m2m_foreign_field like count, sum. If there is aggregate values then there is no need to write initial query set

@elementace
Copy link

@TITANHACKY How did you go about solving this problem?
More importantly, I was hoping to be able to sort by a sum of values

@TITANHACKY
Copy link
Author

Hi @elementace,

I had modified get_initial_queryset and queried the data using annotate method and calculated the sum, count

@elementace
Copy link

Thanks @TITANHACKY , for completion sake; I did it in the filter queryset method, to save in some extra compute.

@TITANHACKY
Copy link
Author

Nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants