On March 28, 2021 1:42:50 AM CDT, Vansh Jagyasi -IIITK <vansh20bcs179@iiitkottayam.ac.in> wrote:
>I have created a model location, and a model transaction which has a
>many
>to one relation with location which has the information of a
>transaction
>done at a particular location, say 3 dollars spent at macdonalds, now I
>
>want to find all the transactions related to a particular location and
>add
>the amount to find the total amount spent,please help
You probably want to use `Sum` from Django aggregate:
https://docs.djangoproject.com/en/3.1/topics/db/aggregation/
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2133D582-868F-4F2D-B09F-F8AB37001CDE%40fattuba.com.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment