parent
473a21cad0
commit
6387e45434
4 changed files with 19 additions and 18 deletions
|
@ -64,7 +64,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{% url 'bird_single' bird.id %}">{{ bird.bird_identifier }}</a></td>
|
<td><a href="{% url 'bird_single' bird.id %}">{{ bird.bird_identifier }}</a></td>
|
||||||
<td>{{ bird.bird }}</td>
|
<td>{{ bird.bird }}</td>
|
||||||
<td>{{ bird.date_found }}</td>
|
<td data-order="{{ forloop.counter }}">{{ bird.date_found }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{% url 'rescuer_single' bird.rescuer_id %}">{{ bird.rescuer|default_if_none:"" }}</a>
|
<a href="{% url 'rescuer_single' bird.rescuer_id %}">{{ bird.rescuer|default_if_none:"" }}</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -50,9 +50,11 @@ def bird_help_single(request, id):
|
||||||
|
|
||||||
@login_required(login_url="account_login")
|
@login_required(login_url="account_login")
|
||||||
def bird_all(request):
|
def bird_all(request):
|
||||||
birds = FallenBird.objects.filter(Q(status="1") | Q(status="2")).annotate(
|
birds = (
|
||||||
total_costs=Sum("costs__costs")
|
FallenBird.objects.filter(Q(status="1") | Q(status="2"))
|
||||||
).order_by("date_found")
|
.annotate(total_costs=Sum("costs__costs"))
|
||||||
|
.order_by("date_found")
|
||||||
|
)
|
||||||
rescuer_modal = Rescuer.objects.all()
|
rescuer_modal = Rescuer.objects.all()
|
||||||
context = {"birds": birds, "rescuer_modal": rescuer_modal}
|
context = {"birds": birds, "rescuer_modal": rescuer_modal}
|
||||||
# Post came from the modal form.
|
# Post came from the modal form.
|
||||||
|
@ -68,9 +70,11 @@ def bird_all(request):
|
||||||
|
|
||||||
@login_required(login_url="account_login")
|
@login_required(login_url="account_login")
|
||||||
def bird_inactive(request):
|
def bird_inactive(request):
|
||||||
birds = FallenBird.objects.filter(
|
birds = (
|
||||||
~Q(status="1") & ~Q(status="2")).annotate(
|
FallenBird.objects.filter(~Q(status="1") & ~Q(status="2"))
|
||||||
total_costs=Sum("costs__costs"))
|
.annotate(total_costs=Sum("costs__costs"))
|
||||||
|
.order_by("date_found")
|
||||||
|
)
|
||||||
context = {"birds": birds}
|
context = {"birds": birds}
|
||||||
return render(request, "bird/bird_inactive.html", context)
|
return render(request, "bird/bird_inactive.html", context)
|
||||||
|
|
||||||
|
@ -83,10 +87,7 @@ def bird_recover_all(request):
|
||||||
@login_required(login_url="account_login")
|
@login_required(login_url="account_login")
|
||||||
def bird_single(request, id):
|
def bird_single(request, id):
|
||||||
bird = FallenBird.objects.get(id=id)
|
bird = FallenBird.objects.get(id=id)
|
||||||
form = BirdEditForm(
|
form = BirdEditForm(request.POST or None, request.FILES or None, instance=bird)
|
||||||
request.POST or None,
|
|
||||||
request.FILES or None,
|
|
||||||
instance=bird)
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
fs = form.save(commit=False)
|
fs = form.save(commit=False)
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td> {{ item.id_bird|default_if_none:"nicht mehr in WVH" }} </td>
|
<td> {{ item.id_bird|default_if_none:"nicht mehr in WVH" }} </td>
|
||||||
<td> {{ item.costs }} €</td>
|
<td> {{ item.costs }} €</td>
|
||||||
<td> {{item.created}} </td>
|
<td data-order="{{ forloop.counter }}"> {{ item.created }} </td>
|
||||||
<td> {{ item.comment|default_if_none:"" }} </td>
|
<td> {{ item.comment|default_if_none:"" }} </td>
|
||||||
<td> {{ item.user }} </td>
|
<td> {{ item.user }} </td>
|
||||||
<td><a href="{% url 'costs_edit' item.id %}"><i class="fa-sharp fa-solid fa-pen"></i></a></td>
|
<td><a href="{% url 'costs_edit' item.id %}"><i class="fa-sharp fa-solid fa-pen"></i></a></td>
|
||||||
|
|
|
@ -7,7 +7,7 @@ from .models import Costs
|
||||||
|
|
||||||
@login_required(login_url="account_login")
|
@login_required(login_url="account_login")
|
||||||
def costs_all(request):
|
def costs_all(request):
|
||||||
costs = Costs.objects.all()
|
costs = Costs.objects.all().order_by("created")
|
||||||
context = {"costs": costs}
|
context = {"costs": costs}
|
||||||
return render(request, "costs/costs_all.html", context)
|
return render(request, "costs/costs_all.html", context)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue