Dashboard dynamic content

* replaces static dummy values with database values
* renames 'Your own' into 'Shared with you' for clarification
* adds translation
pull/2/head
mipel 3 years ago
parent 09fad6a2de
commit d919eee3b4

@ -89,6 +89,9 @@ class Compensation(BaseObject):
geometry = models.ForeignKey(Geometry, null=True, blank=True, on_delete=models.SET_NULL)
documents = models.ManyToManyField("konova.Document", blank=True)
# Holds which intervention is simply a newer version of this dataset
next_version = models.ForeignKey("Compensation", null=True, blank=True, on_delete=models.DO_NOTHING)
intervention = models.ForeignKey(
Intervention,
on_delete=models.CASCADE,

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load i18n fontawesome_5 %}
{% load i18n fontawesome_5 humanize %}
{% block body %}
{% include 'news/dashboard-news.html' %}
@ -21,11 +21,11 @@
<div class="col-sm">
<div class="col-md mb-2">
<div>{% trans 'Total' %}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{total_intervention_count}}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{total_intervention_count|intcomma}}</div>
</div>
<div class="col-md">
<div>{% trans 'Your own' %}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{user_intervention_count}}</div>
<div>{% trans 'Shared with you' %}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{user_intervention_count|intcomma}}</div>
</div>
</div>
</div>
@ -59,11 +59,11 @@
<div class="col-sm">
<div class="col-md mb-2">
<div>{% trans 'Total' %}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{total_compensation_count}}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{total_compensation_count|intcomma}}</div>
</div>
<div class="col-md">
<div>{% trans 'Your own' %}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{user_compensation_count}}</div>
<div>{% trans 'Shared with you' %}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{user_compensation_count|intcomma}}</div>
</div>
</div>
</div>
@ -98,11 +98,11 @@
<div class="col-sm">
<div class="col-md mb-2">
<div>{% trans 'Total' %}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{total_eco_count}}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{total_eco_count|intcomma}}</div>
</div>
<div class="col-md">
<div>{% trans 'Your own' %}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{user_eco_count}}</div>
<div>{% trans 'Shared with you' %}</div>
<div class="class badge badge-pill rlp-gd-outline w-100">{{user_eco_count|intcomma}}</div>
</div>
</div>
</div>

@ -13,6 +13,8 @@ from django.shortcuts import redirect, render, get_object_or_404
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from compensation.models import Compensation, EcoAccount
from intervention.models import Intervention
from konova.contexts import BaseContext
from konova.forms import RemoveModalForm
from konova.models import Document
@ -47,6 +49,8 @@ def home_view(request: HttpRequest):
"""
template = "konova/home.html"
now = timezone.now()
user = request.user
# Fetch the four newest active and published ServerMessages
msgs = ServerMessage.objects.filter(
is_active=True,
@ -56,14 +60,43 @@ def home_view(request: HttpRequest):
"-publish_on"
)[:4]
# First fetch all valid objects (undeleted, only newest versions)
interventions = Intervention.objects.filter(
deleted_on=None,
deleted_by=None,
next_version=None,
)
# Then fetch only user related ones
user_interventions = interventions.filter(
users__in=[user]
)
# Repeat for other objects
comps = Compensation.objects.filter(
deleted_on=None,
deleted_by=None,
next_version=None,
)
user_comps = comps.filter(
users__in=[user]
)
eco_accs = EcoAccount.objects.filter(
deleted_on=None,
deleted_by=None,
next_version=None,
)
user_ecco_accs = eco_accs.filter(
users__in=[user]
)
additional_context = {
"msgs": msgs,
"total_intervention_count": 123,
"user_intervention_count": 5,
"total_compensation_count": 123,
"user_compensation_count": 5,
"total_eco_count": 123,
"user_eco_count": 5,
"total_intervention_count": interventions.count(),
"user_intervention_count": user_interventions.count(),
"total_compensation_count": comps.count(),
"user_compensation_count": user_comps.count(),
"total_eco_count": eco_accs.count(),
"user_eco_count": user_ecco_accs.count(),
}
context = BaseContext(request, additional_context).context
return render(request, template, context)

Binary file not shown.

@ -3,16 +3,17 @@
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#: compensation/forms.py:26 compensation/forms.py:32 compensation/forms.py:45
#: compensation/forms.py:27 compensation/forms.py:32 compensation/forms.py:45
#: intervention/filters.py:25 intervention/filters.py:31
#: intervention/filters.py:38 intervention/filters.py:39 konova/forms.py:73
#: konova/forms.py:149 konova/forms.py:172 user/forms.py:38
#: intervention/filters.py:38 intervention/filters.py:39 konova/forms.py:78
#: konova/forms.py:154 konova/forms.py:181 konova/forms.py:186
#: konova/forms.py:198 konova/forms.py:209 konova/forms.py:222 user/forms.py:38
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-07-26 10:44+0200\n"
"POT-Creation-Date: 2021-07-28 08:48+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -22,16 +23,17 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: compensation/forms.py:25
#: intervention/templates/intervention/detail-view.html:227
#: compensation/forms.py:26
#: intervention/templates/intervention/detail/related-objects.html:78
msgid "Amount"
msgstr "Betrag"
#: compensation/forms.py:27
#: compensation/forms.py:28
msgid "Amount in Euro"
msgstr "Betrag in Euro"
#: compensation/forms.py:31
#: intervention/templates/intervention/detail/related-objects.html:81
msgid "Due on"
msgstr "Fällig am"
@ -47,29 +49,29 @@ msgstr "Verwendungszweck"
msgid "Note for money transfer"
msgstr "Verwendungszweck für Überweisung"
#: compensation/forms.py:55
#: compensation/forms.py:54
msgid "Payment"
msgstr "Zahlung"
#: compensation/forms.py:56
#: compensation/forms.py:55
msgid "Add a payment for intervention '{}'"
msgstr "Neue Ersatzzahlung zu Eingriff '{}' hinzufügen"
#: compensation/tables.py:18 compensation/tables.py:71 intervention/forms.py:26
#: intervention/tables.py:23
#: intervention/templates/intervention/detail-view.html:179
#: intervention/templates/intervention/detail/related-objects.html:30
msgid "Identifier"
msgstr "Kennung"
#: compensation/tables.py:23 compensation/tables.py:76 intervention/forms.py:33
#: intervention/tables.py:28
#: intervention/templates/intervention/detail-view.html:62
#: intervention/templates/intervention/detail-view.html:182
#: intervention/templates/intervention/detail-view.html:287
#: intervention/templates/intervention/detail/related-documents.html:28
#: intervention/templates/intervention/detail/related-objects.html:33
#: intervention/templates/intervention/detail/view.html:62 konova/forms.py:180
msgid "Title"
msgstr "Bezeichnung"
#: compensation/tables.py:28 compensation/tables.py:81
#: compensation/tables.py:28 compensation/tables.py:81 konova/forms.py:185
msgid "Created on"
msgstr "Erstellt"
@ -78,7 +80,7 @@ msgid "Actions"
msgstr "Aktionen"
#: compensation/tables.py:44
#: intervention/templates/intervention/detail-view.html:159
#: intervention/templates/intervention/detail/related-objects.html:10
msgid "Compensations"
msgstr "Kompensationen"
@ -110,7 +112,8 @@ msgstr "Ökokonten"
msgid "Payment added"
msgstr "Zahlung hinzugefügt"
#: compensation/views.py:142 compensation/views.py:180 konova/views.py:137
#: compensation/views.py:142 compensation/views.py:180
#: intervention/views.py:101 konova/views.py:153
msgid "There was an error on this form."
msgstr "Es gab einen Fehler im Formular."
@ -147,7 +150,7 @@ msgid "Which intervention type is this"
msgstr "Welcher Eingriffstyp"
#: intervention/forms.py:44
#: intervention/templates/intervention/detail-view.html:70
#: intervention/templates/intervention/detail/view.html:70
msgid "Law"
msgstr "Gesetz"
@ -156,7 +159,7 @@ msgid "Based on which law"
msgstr "Basiert auf welchem Recht"
#: intervention/forms.py:50
#: intervention/templates/intervention/detail-view.html:90
#: intervention/templates/intervention/detail/view.html:90
msgid "Intervention handler"
msgstr "Eingriffsverursacher"
@ -205,12 +208,12 @@ msgid "Edit intervention"
msgstr "Eingriff bearbeiten"
#: intervention/tables.py:33
#: intervention/templates/intervention/detail-view.html:94
#: intervention/templates/intervention/detail/view.html:94
msgid "Checked"
msgstr "Geprüft"
#: intervention/tables.py:39
#: intervention/templates/intervention/detail-view.html:108
#: intervention/templates/intervention/detail/view.html:108
msgid "Recorded"
msgstr "Verzeichnet"
@ -227,7 +230,7 @@ msgid "Interventions"
msgstr "Eingriffe"
#: intervention/tables.py:92 intervention/tables.py:170
#: intervention/templates/intervention/detail-view.html:12
#: intervention/templates/intervention/detail/view.html:12
#: konova/templates/konova/home.html:11 templates/navbar.html:22
msgid "Intervention"
msgstr "Eingriff"
@ -256,125 +259,131 @@ msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden"
msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar"
#: intervention/templates/intervention/detail-view.html:17
#: intervention/templates/intervention/detail/related-documents.html:10
msgid "Documents"
msgstr "Dokumente"
#: intervention/templates/intervention/detail/related-documents.html:15
#: konova/forms.py:221
msgid "Add new document"
msgstr "Neues Dokument hinzufügen"
#: intervention/templates/intervention/detail/related-documents.html:31
#: konova/forms.py:208
msgid "Comment"
msgstr "Kommentar"
#: intervention/templates/intervention/detail/related-documents.html:34
#: intervention/templates/intervention/detail/related-objects.html:87
msgid "Action"
msgstr "Aktionen"
#: intervention/templates/intervention/detail/related-documents.html:48
msgid "Remove document"
msgstr "Dokument löschen"
#: intervention/templates/intervention/detail/related-objects.html:15
msgid "Add new compensation"
msgstr "Neue Kompensation hinzufügen"
#: intervention/templates/intervention/detail/related-objects.html:60
msgid "Payments"
msgstr "Ersatzzahlungen"
#: intervention/templates/intervention/detail/related-objects.html:65
msgid "Add new payment"
msgstr "Neue Zahlung hinzufügen"
#: intervention/templates/intervention/detail/related-objects.html:84
msgid "Transfer comment"
msgstr "Verwendungszweck"
#: intervention/templates/intervention/detail/related-objects.html:102
msgid "Remove payment"
msgstr "Zahlung entfernen"
#: intervention/templates/intervention/detail/view.html:17
msgid "Open in LANIS"
msgstr "In LANIS öffnen"
#: intervention/templates/intervention/detail-view.html:22
#: intervention/templates/intervention/detail/view.html:22
msgid "Public report"
msgstr "Öffentlicher Bericht"
#: intervention/templates/intervention/detail-view.html:28
#: intervention/templates/intervention/detail/view.html:28
msgid "Share"
msgstr "Freigabe"
#: intervention/templates/intervention/detail-view.html:33
#: intervention/templates/intervention/detail/view.html:33
msgid "Run check"
msgstr "Prüfung vornehmen"
#: intervention/templates/intervention/detail-view.html:38
#: intervention/templates/intervention/detail/view.html:38
msgid "Record"
msgstr "Verzeichnen"
#: intervention/templates/intervention/detail-view.html:43
#: intervention/templates/intervention/detail/view.html:43
msgid "Edit"
msgstr "Bearbeiten"
#: intervention/templates/intervention/detail-view.html:48
#: intervention/templates/intervention/detail/view.html:48
#: venv/lib/python3.7/site-packages/django/forms/formsets.py:391
msgid "Delete"
msgstr "Löschen"
#: intervention/templates/intervention/detail-view.html:66
#: intervention/templates/intervention/detail/view.html:66
msgid "Process type"
msgstr "Verfahrenstyp"
#: intervention/templates/intervention/detail-view.html:74
#: intervention/templates/intervention/detail/view.html:74
msgid "Registration office"
msgstr "Zulassungsbehörde"
#: intervention/templates/intervention/detail-view.html:78
#: intervention/templates/intervention/detail/view.html:78
msgid "Registration office file number"
msgstr "Aktenzeichen Zulassungsbehörde"
#: intervention/templates/intervention/detail-view.html:82
#: intervention/templates/intervention/detail/view.html:82
msgid "Conservation office"
msgstr "Naturschutzbehörde"
#: intervention/templates/intervention/detail-view.html:86
#: intervention/templates/intervention/detail/view.html:86
msgid "Conversation office file number"
msgstr "Aktenzeichen Naturschutzbehörde"
#: intervention/templates/intervention/detail-view.html:122
#: intervention/templates/intervention/detail/view.html:122
msgid "Registration date"
msgstr "Datum Zulassung bzw. Satzungsbeschluss"
#: intervention/templates/intervention/detail-view.html:126
#: intervention/templates/intervention/detail/view.html:126
msgid "Binding on"
msgstr "Datum Bestandskraft"
#: intervention/templates/intervention/detail-view.html:130
#: intervention/templates/intervention/detail/view.html:130
msgid "Last modified"
msgstr "Zuletzt bearbeitet"
#: intervention/templates/intervention/detail-view.html:134
#: intervention/templates/intervention/detail/view.html:134
msgid "by"
msgstr "von"
#: intervention/templates/intervention/detail-view.html:143
#: intervention/templates/intervention/detail/view.html:143
msgid "No geometry added, yet."
msgstr "Keine Geometrie vorhanden"
#: intervention/templates/intervention/detail-view.html:164
msgid "Add new compensation"
msgstr "Neue Kompensation hinzufügen"
#: intervention/templates/intervention/detail-view.html:209
msgid "Payments"
msgstr "Ersatzzahlungen"
#: intervention/templates/intervention/detail-view.html:214
msgid "Add new payment"
msgstr "Neue Zahlung hinzufügen"
#: intervention/templates/intervention/detail-view.html:230
msgid "Transfer comment"
msgstr "Verwendungszweck"
#: intervention/templates/intervention/detail-view.html:233
#: intervention/templates/intervention/detail-view.html:293
msgid "Action"
msgstr "Aktionen"
#: intervention/templates/intervention/detail-view.html:247
msgid "Remove payment"
msgstr "Zahlung entfernen"
#: intervention/templates/intervention/detail-view.html:267
msgid "Documents"
msgstr "Dokumente"
#: intervention/templates/intervention/detail-view.html:272
msgid "Add new document"
msgstr "Neues Dokument hinzufügen"
#: intervention/templates/intervention/detail-view.html:290
msgid "Comment"
msgstr "Kommentar"
#: intervention/templates/intervention/detail-view.html:307 konova/forms.py:180
msgid "Remove document"
msgstr "Dokument löschen"
#: intervention/views.py:62
msgid "Intervention {} added"
msgstr "Eingriff {} hinzugefügt"
#: intervention/views.py:65 intervention/views.py:128
#: intervention/views.py:65 intervention/views.py:166
msgid "Invalid input"
msgstr "Eingabe fehlerhaft"
#: intervention/views.py:102
#: intervention/views.py:94
msgid "Document '{}' added"
msgstr "Dokument '{}' hinzugefügt"
#: intervention/views.py:140
msgid ""
"Remember: This data has not been shared with you, yet. This means you can "
"only read but can not edit or perform any actions like running a check or "
@ -384,7 +393,7 @@ msgstr ""
"bedeutet, dass Sie nur lesenden Zugriff hierauf haben und weder bearbeiten, "
"noch Prüfungen durchführen oder verzeichnen können."
#: intervention/views.py:125
#: intervention/views.py:163
msgid "{} edited"
msgstr "{} bearbeitet"
@ -400,29 +409,42 @@ msgstr "Hierfür müssen Sie Administrator sein!"
msgid "You need to be part of another user group."
msgstr "Hierfür müssen Sie einer anderen Nutzergruppe angehören!"
#: konova/forms.py:46
#: konova/forms.py:51
msgid "Not editable"
msgstr "Nicht editierbar"
#: konova/forms.py:72 konova/forms.py:148 konova/forms.py:171
#: konova/forms.py:77 konova/forms.py:153
msgid "Confirm"
msgstr "Bestätige"
#: konova/forms.py:84 konova/forms.py:156
#: konova/forms.py:89 konova/forms.py:162
msgid "Remove"
msgstr "Löschen"
#: konova/forms.py:86
#: konova/forms.py:91
msgid "You are about to remove {} {}"
msgstr "Sie sind dabei {} {} zu löschen"
#: konova/forms.py:157
#: konova/forms.py:163
msgid "Are you sure?"
msgstr ""
#: konova/forms.py:181
msgid "This will remove '{}'. Are you sure?"
msgstr "Hiermit wird '{}' gelöscht. Sind Sie sicher?"
#: konova/forms.py:187
msgid "When has this file been created? Important for photos."
msgstr ""
#: konova/forms.py:197
#: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231
msgid "File"
msgstr ""
#: konova/forms.py:199
msgid "Must be smaller than 15 Mb"
msgstr ""
#: konova/forms.py:210
msgid "Additional comment on this file"
msgstr "Zusätzlicher Kommentar"
#: konova/management/commands/setup_data.py:42
msgid "On new related data"
@ -455,8 +477,8 @@ msgstr "Insgesamt"
#: konova/templates/konova/home.html:27 konova/templates/konova/home.html:65
#: konova/templates/konova/home.html:104
msgid "Your own"
msgstr "Eigene"
msgid "Shared with you"
msgstr "Für Sie freigegeben"
#: konova/templates/konova/home.html:35 konova/templates/konova/home.html:73
#: konova/templates/konova/home.html:114
@ -476,7 +498,7 @@ msgstr "Ökokonto"
msgid "Withdraw"
msgstr "Abbuchen"
#: konova/views.py:131
#: konova/views.py:147
msgid "Document '{}' deleted"
msgstr "Dokument '{}' gelöscht"
@ -1045,10 +1067,6 @@ msgstr ""
msgid "Universally unique identifier"
msgstr ""
#: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231
msgid "File"
msgstr ""
#: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:379
msgid "Image"
msgstr ""
@ -1848,15 +1866,18 @@ msgstr ""
msgid "A fontawesome icon field"
msgstr ""
#~ msgid "This will remove '{}'. Are you sure?"
#~ msgstr "Hiermit wird '{}' gelöscht. Sind Sie sicher?"
#~ msgid "Your own"
#~ msgstr "Eigene"
#~ msgid "Default"
#~ msgstr "Standard"
#~ msgid "Quickstart"
#~ msgstr "Schnellstart"
#~ msgid "Proceed with login"
#~ msgstr "Mit Login fortfahren"
#~ msgid "Logged in as"
#~ msgstr "Eingeloggt als"
@ -2022,9 +2043,6 @@ msgstr ""
#~ msgid "Current role"
#~ msgstr "Aktuelle Rolle"
#~ msgid "Additional comment"
#~ msgstr "Zusätzlicher Kommentar"
#~ msgid "Object title"
#~ msgstr "Objekt Titel"

Loading…
Cancel
Save