costs sum works in view fallenbirds
This commit is contained in:
parent
c06acb284a
commit
57bd930907
4 changed files with 4 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
|||
import names
|
||||
from django.db.models import Sum
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import HttpResponse, redirect, render
|
||||
from rescuer.models import Rescuer
|
||||
|
@ -42,7 +43,7 @@ def bird_help(request):
|
|||
|
||||
@login_required(login_url="account_login")
|
||||
def bird_all(request):
|
||||
birds = FallenBird.objects.all()
|
||||
birds = FallenBird.objects.all().annotate(total_costs=Sum('costs__costs'))
|
||||
rescuer_modal = Rescuer.objects.all()
|
||||
context = {"birds": birds, "rescuer_modal": rescuer_modal}
|
||||
# Post came from the modal form.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue