diff --git a/app/core/settings.py b/app/core/settings.py index df37bc0..52d1afd 100644 --- a/app/core/settings.py +++ b/app/core/settings.py @@ -73,6 +73,7 @@ INSTALLED_APPS = [ "aviary", "bird", "costs", + "export", "rescuer", "sites", ] diff --git a/app/export/templates/export/export_site.html b/app/export/templates/export/overview.html similarity index 100% rename from app/export/templates/export/export_site.html rename to app/export/templates/export/overview.html diff --git a/app/export/views.py b/app/export/views.py index 5993e1d..ae9d5df 100644 --- a/app/export/views.py +++ b/app/export/views.py @@ -1,7 +1,7 @@ import csv -from costs.models import Costs from bird.models import FallenBird +from costs.models import Costs from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import render @@ -9,20 +9,14 @@ from django.shortcuts import render @login_required(login_url="account_login") def site_exports(request): - return render( - request, - "export/export_site.html", - ) + return render(request, "export/overview.html") @login_required(login_url="account_login") def export_costs(request): costs = Costs.objects.all().values_list( - "id_bird__bird_identifier", - "costs", - "created", - "comment", - "user__username") + "id_bird__bird_identifier", "costs", "created", "comment", "user__username" + ) response = HttpResponse(content_type="text/csv") response["Content-Disposition"] = "attachment, filename=fbf_costs.csv" writer = csv.writer(response) @@ -51,27 +45,30 @@ def export_birds(request): "user__username", "status__description", "aviary__description", - "sent_to" - ) + "sent_to", + ) response = HttpResponse(content_type="text/csv") response["Content-Disposition"] = "attachment, filename=fbf_birds.csv" writer = csv.writer(response) - writer.writerow(["Vogel", - "Patienten Alias", - "Alter", - "Geschlecht", - "gefunden am", - "Fundort", - "Pateient angelegt am", - "Pateient aktualisiert am", - "Fundumstände", - "Diagnose bei Fund", - "Finder (Nachname)", - "Benutzer", - "Status", - "Voliere", - "Übersandt" - ]) + writer.writerow( + [ + "Vogel", + "Patienten Alias", + "Alter", + "Geschlecht", + "gefunden am", + "Fundort", + "Pateient angelegt am", + "Pateient aktualisiert am", + "Fundumstände", + "Diagnose bei Fund", + "Finder (Nachname)", + "Benutzer", + "Status", + "Voliere", + "Übersandt", + ] + ) for bird in birds: writer.writerow(bird) return response