Fixes and improvements

* moves diff_states message back to table top for direct presentation in compensation/detail/view.html
* removes diff_states rendering in deadline card in compensation/detail/view.html
* fixes before_state adding based on GET parameter
* refactors UserActionlogEntryEnum into a UserAction TextChoice (Django 3.x)
* adds ordering of compensation states depending on surface value
* refactors ServerMessageImportance from enum into TextChoice (Django 3.x)
* adds/updates translations
pull/9/head
mipel 3 years ago
parent 816600535a
commit cd5b2e264b

@ -6,14 +6,18 @@ Created on: 04.12.20
"""
from django import forms
from django.contrib import messages
from django.db import transaction
from django.http import HttpRequest
from django.shortcuts import redirect, render
from django.utils.translation import gettext_lazy as _
from compensation.models import Payment, CompensationState
from konova.enums import UserActionLogEntryEnum
from konova.contexts import BaseContext
from konova.forms import BaseForm, BaseModalForm
from konova.models import Deadline, DeadlineType
from user.models import UserActionLogEntry
from konova.utils.message_templates import FORM_INVALID
from user.models import UserActionLogEntry, UserAction
class NewCompensationForm(BaseForm):
@ -61,7 +65,7 @@ class NewPaymentForm(BaseModalForm):
with transaction.atomic():
action = UserActionLogEntry.objects.create(
user=self.user,
action=UserActionLogEntryEnum.CREATED.value,
action=UserAction.CREATED,
)
pay = Payment.objects.create(
created=action,
@ -106,6 +110,45 @@ class NewStateModalForm(BaseModalForm):
self.instance.after_states.add(state)
return state
def process_request(self, request: HttpRequest, msg_success: str = _("Object removed"), msg_error: str = FORM_INVALID, redirect_url: str = None):
""" Generic processing of request
Wraps the request processing logic, so we don't need the same code everywhere a RemoveModalForm is being used
Args:
request (HttpRequest): The incoming request
msg_success (str): The message in case of successful removing
msg_error (str): The message in case of an error
Returns:
"""
redirect_url = redirect_url if redirect_url is not None else request.META.get("HTTP_REFERER", "home")
template = self.template
if request.method == "POST":
if self.is_valid():
is_before_state = bool(request.GET.get("before", False))
self.save(is_before_state=is_before_state)
messages.success(
request,
msg_success
)
return redirect(redirect_url)
else:
messages.info(
request,
msg_error
)
return redirect(redirect_url)
elif request.method == "GET":
context = {
"form": self,
}
context = BaseContext(request, context).context
return render(request, template, context)
else:
raise NotImplementedError
class NewDeadlineModalForm(BaseModalForm):
type = forms.ChoiceField(
@ -150,7 +193,7 @@ class NewDeadlineModalForm(BaseModalForm):
with transaction.atomic():
action = UserActionLogEntry.objects.create(
user=self.user,
action=UserActionLogEntryEnum.CREATED.value
action=UserAction.CREATED.value
)
deadline = Deadline.objects.create(
type=self.cleaned_data["type"],

@ -14,11 +14,10 @@ from django.utils.timezone import now
from compensation.settings import COMPENSATION_IDENTIFIER_LENGTH, COMPENSATION_IDENTIFIER_TEMPLATE
from intervention.models import Intervention, ResponsibilityData
from konova.enums import UserActionLogEntryEnum
from konova.models import BaseObject, BaseResource, Geometry, UuidModel
from konova.utils.generators import generate_random_string
from organisation.models import Organisation
from user.models import UserActionLogEntry
from user.models import UserActionLogEntry, UserAction
class Payment(BaseResource):
@ -156,11 +155,9 @@ class Compensation(AbstractCompensation):
action = UserActionLogEntry.objects.create(
user=_user,
timestamp=_now,
action=UserActionLogEntryEnum.DELETED.value
action=UserAction.DELETED
)
self.deleted = action
#self.deleted_on = _now
#self.deleted_by = _user
self.save()
def save(self, *args, **kwargs):

@ -57,10 +57,5 @@
{% endfor %}
</tbody>
</table>
{% if sum_before_states > sum_after_states %}
<div class="row alert alert-danger">
{% trans 'Missing surfaces: ' %}{{ diff_states|floatformat:2 }} m²
</div>
{% endif %}
</div>
</div>

@ -21,6 +21,11 @@
</div>
</div>
<div class="card-body scroll-300">
{% if sum_before_states > sum_after_states %}
<div class="row alert alert-danger">
{% trans 'Missing surfaces: ' %}{{ diff_states|floatformat:2 }} m²
</div>
{% endif %}
<table class="table table-hover">
<thead>
<tr>
@ -36,7 +41,7 @@
</tr>
</thead>
<tbody>
{% for state in comp.after_states.all %}
{% for state in after_states %}
<tr>
<td class="align-middle">
{{ state.biotope_type }}
@ -53,10 +58,5 @@
{% endfor %}
</tbody>
</table>
{% if sum_before_states > sum_after_states %}
<div class="row alert alert-danger">
{% trans 'Missing surfaces: ' %}{{ diff_states|floatformat:2 }} m²
</div>
{% endif %}
</div>
</div>

@ -21,6 +21,11 @@
</div>
</div>
<div class="card-body scroll-300">
{% if sum_before_states < sum_after_states %}
<div class="row alert alert-danger">
{% trans 'Missing surfaces: ' %}{{ diff_states|floatformat:2 }} m²
</div>
{% endif %}
<table class="table table-hover">
<thead>
<tr>
@ -36,7 +41,7 @@
</tr>
</thead>
<tbody>
{% for state in comp.before_states.all %}
{% for state in before_states %}
<tr>
<td class="align-middle">
{{ state.biotope_type }}
@ -53,10 +58,5 @@
{% endfor %}
</tbody>
</table>
{% if sum_before_states < sum_after_states %}
<div class="row alert alert-danger">
{% trans 'Missing surfaces: ' %}{{ diff_states|floatformat:2 }} m²
</div>
{% endif %}
</div>
</div>

@ -76,22 +76,28 @@ def open_view(request: HttpRequest, id: str):
_user = request.user
is_data_shared = comp.intervention.is_shared_with(_user)
# Order states according to surface
before_states = comp.before_states.all().order_by("-surface")
after_states = comp.after_states.all().order_by("-surface")
# Precalculate logical errors between before- and after-states
# Sum() returns None in case of no states, so we catch that and replace it with 0 for easier handling
sum_before_states = comp.before_states.all().aggregate(Sum("surface"))["surface__sum"] or 0
sum_after_states = comp.after_states.all().aggregate(Sum("surface"))["surface__sum"] or 0
sum_before_states = before_states.aggregate(Sum("surface"))["surface__sum"] or 0
sum_after_states = after_states.aggregate(Sum("surface"))["surface__sum"] or 0
diff_states = abs(sum_before_states - sum_after_states)
context = {
"comp": comp,
"geom_form": geom_form,
"has_access": is_data_shared,
"is_default_member": in_group(_user, _(DEFAULT_GROUP)),
"is_zb_member": in_group(_user, _(ZB_GROUP)),
"is_ets_member": in_group(_user, _(ETS_GROUP)),
"before_states": before_states,
"after_states": after_states,
"sum_before_states": sum_before_states,
"sum_after_states": sum_after_states,
"diff_states": diff_states,
"is_default_member": in_group(_user, _(DEFAULT_GROUP)),
"is_zb_member": in_group(_user, _(ZB_GROUP)),
"is_ets_member": in_group(_user, _(ETS_GROUP)),
}
context = BaseContext(request, context).context
return render(request, template, context)

@ -15,13 +15,12 @@ from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from intervention.models import Intervention
from konova.enums import UserActionLogEntryEnum
from konova.forms import BaseForm, BaseModalForm
from konova.models import Document
from konova.settings import DEFAULT_LAT, DEFAULT_LON, DEFAULT_ZOOM, ZB_GROUP, ETS_GROUP
from konova.utils.user_checks import in_group
from organisation.models import Organisation
from user.models import UserActionLogEntry
from user.models import UserActionLogEntry, UserAction
class NewInterventionForm(BaseForm):
@ -120,7 +119,7 @@ class NewInterventionForm(BaseForm):
action = UserActionLogEntry.objects.create(
user=user,
action=UserActionLogEntryEnum.CREATED.value,
action=UserAction.CREATED,
)
intervention = Intervention(
identifier=identifier,

@ -12,12 +12,11 @@ from django.utils import timezone
from django.utils.timezone import now
from intervention.settings import INTERVENTION_IDENTIFIER_LENGTH, INTERVENTION_IDENTIFIER_TEMPLATE
from konova.enums import UserActionLogEntryEnum
from konova.models import BaseObject, Geometry, UuidModel
from konova.utils import generators
from konova.utils.generators import generate_random_string
from organisation.models import Organisation
from user.models import UserActionLogEntry
from user.models import UserActionLogEntry, UserAction
class ResponsibilityData(UuidModel):
@ -139,7 +138,7 @@ class Intervention(BaseObject):
action = UserActionLogEntry.objects.create(
user=_user,
timestamp=_now,
action=UserActionLogEntryEnum.DELETED.value
action=UserAction.DELETED
)
for com in coms:
com.deleted = action

@ -38,22 +38,3 @@ class UnitEnum(BaseEnum):
ha = "ha"
st = "St." # pieces
class ServerMessageImportance(BaseEnum):
"""
Defines importance levels for server messages
"""
DEFAULT = "DEFAULT"
INFO = "INFO"
WARNING = "WARNING"
class UserActionLogEntryEnum(BaseEnum):
"""
Defines different possible user actions for UserActionLogEntry
"""
CHECKED = "Checked"
RECORDED = "Recorded"
CREATED = "Created"
DELETED = "Deleted"

@ -21,10 +21,9 @@ from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from konova.contexts import BaseContext
from konova.enums import UserActionLogEntryEnum
from konova.models import Document
from konova.utils.message_templates import FORM_INVALID
from user.models import UserActionLogEntry
from user.models import UserActionLogEntry, UserAction
class BaseForm(forms.Form):
@ -117,11 +116,9 @@ class RemoveForm(BaseForm):
action = UserActionLogEntry.objects.create(
user=user,
timestamp=timezone.now(),
action=UserActionLogEntryEnum.DELETED.value
action=UserAction.DELETED
)
self.object_to_remove.deleted = action
#self.object_to_remove.deleted_on = timezone.now()
#self.object_to_remove.deleted_by = user
self.object_to_remove.save()
return self.object_to_remove
@ -229,11 +226,9 @@ class RemoveModalForm(BaseModalForm):
action = UserActionLogEntry.objects.create(
user=self.user,
timestamp=timezone.now(),
action=UserActionLogEntryEnum.DELETED.value,
action=UserAction.DELETED,
)
self.instance.deleted = action
#self.instance.deleted_on = timezone.now()
#self.instance.deleted_by = self.user
self.instance.save()
else:
# If the class does not provide restorable delete functionality, we must delete the entry finally
@ -297,7 +292,7 @@ class NewDocumentForm(BaseModalForm):
with transaction.atomic():
action = UserActionLogEntry.objects.create(
user=self.user,
action=UserActionLogEntryEnum.CREATED.value,
action=UserAction.CREATED,
)
doc = Document.objects.create(
created=action,

@ -12,7 +12,6 @@ from django.utils.translation import gettext_lazy as _
from django.contrib.gis.db.models import MultiPolygonField
from django.db import models
from konova.settings import DEFAULT_SRID
from user.models import UserActionLogEntry
@ -120,4 +119,5 @@ class Geometry(BaseResource):
"""
Outsourced geometry model so multiple versions of the same object can refer to the same geometry if it is not changed
"""
from konova.settings import DEFAULT_SRID
geom = MultiPolygonField(null=True, blank=True, srid=DEFAULT_SRID)

@ -12,7 +12,6 @@ https://docs.djangoproject.com/en/3.1/ref/settings/
from django.utils.translation import gettext_lazy as _
# Load other settings
from konova.enums import ServerMessageImportance
from konova.sub_settings.django_settings import *
# Num of days if user enables Remember-me on login
@ -55,12 +54,6 @@ DEFAULT_GROUP = "Default"
ZB_GROUP = "Registration office"
ETS_GROUP = "Conservation office"
# ServerMessageImportance bootstrap resolver
SVI_BOOTSTRAP_CLS_MAP = {
ServerMessageImportance.DEFAULT.value: "",
ServerMessageImportance.WARNING.value: "alert-danger",
ServerMessageImportance.INFO.value: "alert-info",
}
# HELP PAGE LINK
HELP_LINK = "https://dienste.naturschutz.rlp.de/doku/doku.php?id=ksp:start"

@ -6,11 +6,19 @@ Created on: 05.07.21
"""
from django import template
from konova.settings import SVI_BOOTSTRAP_CLS_MAP
# Create custom library
from news.models import ServerMessageImportance
register = template.Library()
# ServerMessageImportance bootstrap resolver
SVI_BOOTSTRAP_CLS_MAP = {
ServerMessageImportance.DEFAULT.name: "",
ServerMessageImportance.WARNING.name: "alert-danger",
ServerMessageImportance.INFO.name: "alert-info",
}
@register.filter("bootstrap_cls")
def bootstrap_cls(value):

Binary file not shown.

@ -4,17 +4,17 @@
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#: compensation/forms.py:34 compensation/forms.py:39 compensation/forms.py:52
#: compensation/forms.py:138 intervention/filters.py:26
#: compensation/forms.py:177 intervention/filters.py:26
#: intervention/filters.py:40 intervention/filters.py:47
#: intervention/filters.py:48 konova/forms.py:85 konova/forms.py:216
#: konova/forms.py:249 konova/forms.py:254 konova/forms.py:266
#: konova/forms.py:277 konova/forms.py:290 user/forms.py:38
#: intervention/filters.py:48 konova/forms.py:84 konova/forms.py:213
#: konova/forms.py:244 konova/forms.py:249 konova/forms.py:261
#: konova/forms.py:272 konova/forms.py:285 user/forms.py:38
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-03 12:54+0200\n"
"POT-Creation-Date: 2021-08-03 17:21+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"
@ -67,8 +67,8 @@ msgid "Select the biotope type"
msgstr "Biotoptyp wählen"
#: compensation/forms.py:90
#: compensation/templates/compensation/detail/includes/states-after.html:31
#: compensation/templates/compensation/detail/includes/states-before.html:31
#: compensation/templates/compensation/detail/includes/states-after.html:36
#: compensation/templates/compensation/detail/includes/states-before.html:36
msgid "Surface"
msgstr "Fläche"
@ -84,45 +84,49 @@ msgstr "Neuer Zustand"
msgid "Insert data for the new state"
msgstr "Geben Sie die Daten des neuen Zustandes ein"
#: compensation/forms.py:116
#: compensation/forms.py:113 konova/forms.py:134
msgid "Object removed"
msgstr "Objekt entfernt"
#: compensation/forms.py:155
msgid "Deadline Type"
msgstr "Fristart"
#: compensation/forms.py:119
#: compensation/forms.py:158
msgid "Select the deadline type"
msgstr "Fristart wählen"
#: compensation/forms.py:123
#: compensation/forms.py:162
#: compensation/templates/compensation/detail/includes/deadlines.html:31
msgid "Date"
msgstr "Datum"
#: compensation/forms.py:126
#: compensation/forms.py:165
msgid "Select date"
msgstr "Datum wählen"
#: compensation/forms.py:137
#: compensation/forms.py:176
#: compensation/templates/compensation/detail/includes/deadlines.html:34
#: compensation/templates/compensation/detail/includes/documents.html:31
#: intervention/templates/intervention/detail/includes/documents.html:31
#: konova/forms.py:276
#: konova/forms.py:271
msgid "Comment"
msgstr "Kommentar"
#: compensation/forms.py:139
#: compensation/forms.py:178
msgid "Additional comment"
msgstr "Zusätzlicher Kommentar"
#: compensation/forms.py:150
#: compensation/forms.py:189
msgid "New deadline"
msgstr "Neue Frist"
#: compensation/forms.py:151
#: compensation/forms.py:190
msgid "Insert data for the new deadline"
msgstr "Geben Sie die Daten der neuen Frist ein"
#: compensation/tables.py:24 compensation/tables.py:164
#: intervention/forms.py:29 intervention/tables.py:23
#: intervention/forms.py:28 intervention/tables.py:23
#: intervention/templates/intervention/detail/includes/compensations.html:30
msgid "Identifier"
msgstr "Kennung"
@ -130,24 +134,24 @@ msgstr "Kennung"
#: compensation/tables.py:29 compensation/tables.py:169
#: compensation/templates/compensation/detail/includes/documents.html:28
#: compensation/templates/compensation/detail/view.html:47
#: intervention/forms.py:36 intervention/tables.py:28
#: intervention/forms.py:35 intervention/tables.py:28
#: intervention/templates/intervention/detail/includes/compensations.html:33
#: intervention/templates/intervention/detail/includes/documents.html:28
#: intervention/templates/intervention/detail/view.html:64 konova/forms.py:248
#: intervention/templates/intervention/detail/view.html:64 konova/forms.py:243
msgid "Title"
msgstr "Bezeichnung"
#: compensation/tables.py:34
#: compensation/templates/compensation/detail/view.html:59
#: intervention/tables.py:33
#: intervention/templates/intervention/detail/view.html:96
#: intervention/templates/intervention/detail/view.html:96 user/models.py:48
msgid "Checked"
msgstr "Geprüft"
#: compensation/tables.py:40
#: compensation/templates/compensation/detail/view.html:73
#: intervention/tables.py:39
#: intervention/templates/intervention/detail/view.html:110
#: intervention/templates/intervention/detail/view.html:110 user/models.py:49
msgid "Recorded"
msgstr "Verzeichnet"
@ -202,7 +206,7 @@ msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden"
msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar"
#: compensation/tables.py:174 konova/forms.py:253
#: compensation/tables.py:174 konova/forms.py:248
msgid "Created on"
msgstr "Erstellt"
@ -231,14 +235,14 @@ msgid "Add new deadline"
msgstr "Neue Frist hinzufügen"
#: compensation/templates/compensation/detail/includes/deadlines.html:28
#: intervention/forms.py:41
#: intervention/forms.py:40
msgid "Type"
msgstr "Typ"
#: compensation/templates/compensation/detail/includes/deadlines.html:37
#: compensation/templates/compensation/detail/includes/documents.html:34
#: compensation/templates/compensation/detail/includes/states-after.html:34
#: compensation/templates/compensation/detail/includes/states-before.html:34
#: compensation/templates/compensation/detail/includes/states-after.html:39
#: compensation/templates/compensation/detail/includes/states-before.html:39
#: intervention/templates/intervention/detail/includes/compensations.html:36
#: intervention/templates/intervention/detail/includes/documents.html:34
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:36
@ -250,12 +254,6 @@ msgstr "Aktionen"
msgid "Remove deadline"
msgstr "Frist löschen"
#: compensation/templates/compensation/detail/includes/deadlines.html:62
#: compensation/templates/compensation/detail/includes/states-after.html:58
#: compensation/templates/compensation/detail/includes/states-before.html:58
msgid "Missing surfaces: "
msgstr "Fehlende Flächen: "
#: compensation/templates/compensation/detail/includes/documents.html:8
#: intervention/templates/intervention/detail/includes/documents.html:8
msgid "Documents"
@ -263,7 +261,7 @@ msgstr "Dokumente"
#: compensation/templates/compensation/detail/includes/documents.html:14
#: intervention/templates/intervention/detail/includes/documents.html:14
#: konova/forms.py:289
#: konova/forms.py:284
msgid "Add new document"
msgstr "Neues Dokument hinzufügen"
@ -280,13 +278,18 @@ msgstr "Zielzustand"
msgid "Add new state after"
msgstr "Neuen Zielzustand hinzufügen"
#: compensation/templates/compensation/detail/includes/states-after.html:28
#: compensation/templates/compensation/detail/includes/states-before.html:28
#: compensation/templates/compensation/detail/includes/states-after.html:26
#: compensation/templates/compensation/detail/includes/states-before.html:26
msgid "Missing surfaces: "
msgstr "Fehlende Flächen: "
#: compensation/templates/compensation/detail/includes/states-after.html:33
#: compensation/templates/compensation/detail/includes/states-before.html:33
msgid "Biotope type"
msgstr "Biotoptyp"
#: compensation/templates/compensation/detail/includes/states-after.html:47
#: compensation/templates/compensation/detail/includes/states-before.html:47
#: compensation/templates/compensation/detail/includes/states-after.html:52
#: compensation/templates/compensation/detail/includes/states-before.html:52
msgid "Remove state"
msgstr "Zustand entfernen"
@ -346,7 +349,7 @@ msgid "Last modified"
msgstr "Zuletzt bearbeitet"
#: compensation/templates/compensation/detail/view.html:97
#: intervention/forms.py:257
#: intervention/forms.py:256
#: intervention/templates/intervention/detail/view.html:142
msgid "Shared with"
msgstr "Freigegeben für"
@ -356,35 +359,35 @@ msgstr "Freigegeben für"
msgid "No geometry added, yet."
msgstr "Keine Geometrie vorhanden"
#: compensation/views.py:115
#: compensation/views.py:121
msgid "Compensation removed"
msgstr "Kompensation entfernt"
#: compensation/views.py:195
#: compensation/views.py:201
msgid "Payment added"
msgstr "Zahlung hinzugefügt"
#: compensation/views.py:230
#: compensation/views.py:236
msgid "Payment removed"
msgstr "Zahlung gelöscht"
#: compensation/views.py:256
#: compensation/views.py:262
msgid "Withdraw removed"
msgstr "Abbuchung entfernt"
#: compensation/views.py:274
#: compensation/views.py:280
msgid "Document added"
msgstr "Dokument hinzugefügt"
#: compensation/views.py:293
#: compensation/views.py:299
msgid "State added"
msgstr "Zustand hinzugefügt"
#: compensation/views.py:312
#: compensation/views.py:318
msgid "Deadline added"
msgstr "Frist hinzugefügt"
#: compensation/views.py:322
#: compensation/views.py:328
msgid "State removed"
msgstr "Zustand gelöscht"
@ -404,90 +407,90 @@ msgstr "Gemarkung"
msgid "Search for district"
msgstr "Nach Gemarkung suchen"
#: intervention/forms.py:32
#: intervention/forms.py:31
msgid "Generated automatically if none was given"
msgstr "Wird automatisch erzeugt, falls nicht angegeben"
#: intervention/forms.py:44
#: intervention/forms.py:43
msgid "Which intervention type is this"
msgstr "Welcher Eingriffstyp"
#: intervention/forms.py:47
#: intervention/forms.py:46
#: intervention/templates/intervention/detail/view.html:72
msgid "Law"
msgstr "Gesetz"
#: intervention/forms.py:50
#: intervention/forms.py:49
msgid "Based on which law"
msgstr "Basiert auf welchem Recht"
#: intervention/forms.py:53
#: intervention/forms.py:52
#: intervention/templates/intervention/detail/view.html:92
msgid "Intervention handler"
msgstr "Eingriffsverursacher"
#: intervention/forms.py:56
#: intervention/forms.py:55
msgid "Who performs the intervention"
msgstr "Wer führt den Eingriff durch"
#: intervention/forms.py:59
#: intervention/forms.py:58
msgid "Data provider"
msgstr "Datenbereitsteller"
#: intervention/forms.py:61
#: intervention/forms.py:60
msgid "Who provides the data for the intervention"
msgstr "Wer stellt die Daten für den Eingriff zur Verfügung"
#: intervention/forms.py:66
#: intervention/forms.py:65
msgid "Organization"
msgstr "Organisation"
#: intervention/forms.py:72
#: intervention/forms.py:71
msgid "Data provider details"
msgstr "Datenbereitsteller Details"
#: intervention/forms.py:75
#: intervention/forms.py:74
msgid "Further details"
msgstr "Weitere Details"
#: intervention/forms.py:88
#: intervention/forms.py:87
msgid "Map"
msgstr "Karte"
#: intervention/forms.py:90
#: intervention/forms.py:89
msgid "Where does the intervention take place"
msgstr "Wo findet der Eingriff statt"
#: intervention/forms.py:98
#: intervention/forms.py:97
msgid "Files"
msgstr "Dateien"
#: intervention/forms.py:105
#: intervention/forms.py:104
msgid "New intervention"
msgstr "Neuer Eingriff"
#: intervention/forms.py:152
#: intervention/forms.py:151
msgid "Edit intervention"
msgstr "Eingriff bearbeiten"
#: intervention/forms.py:246
#: intervention/forms.py:245
msgid "Share link"
msgstr "Freigabelink"
#: intervention/forms.py:248
#: intervention/forms.py:247
msgid "Send this link to users who you want to have writing access on the data"
msgstr "Andere Nutzer erhalten über diesen Link Zugriff auf die Daten"
#: intervention/forms.py:260
#: intervention/forms.py:259
msgid "Remove check to remove access for this user"
msgstr "Wählen Sie die Nutzer ab, die keinen Zugriff mehr haben sollen"
#: intervention/forms.py:271
#: intervention/forms.py:270
#: intervention/templates/intervention/detail/view.html:27
msgid "Share"
msgstr "Freigabe"
#: intervention/forms.py:272
#: intervention/forms.py:271
msgid "Share settings for {}"
msgstr "Freigabe Einstellungen für {}"
@ -645,44 +648,40 @@ msgstr ""
msgid "You need to be part of another user group."
msgstr "Hierfür müssen Sie einer anderen Nutzergruppe angehören!"
#: konova/forms.py:58
#: konova/forms.py:57
msgid "Not editable"
msgstr "Nicht editierbar"
#: konova/forms.py:84 konova/forms.py:215
#: konova/forms.py:83 konova/forms.py:212
msgid "Confirm"
msgstr "Bestätige"
#: konova/forms.py:96 konova/forms.py:224
#: konova/forms.py:95 konova/forms.py:221
msgid "Remove"
msgstr "Löschen"
#: konova/forms.py:98
#: konova/forms.py:97
msgid "You are about to remove {} {}"
msgstr "Sie sind dabei {} {} zu löschen"
#: konova/forms.py:137
msgid "Object removed"
msgstr "Objekt entfernt"
#: konova/forms.py:225
#: konova/forms.py:222
msgid "Are you sure?"
msgstr "Sind Sie sicher?"
#: konova/forms.py:255
#: konova/forms.py:250
msgid "When has this file been created? Important for photos."
msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?"
#: konova/forms.py:265
#: konova/forms.py:260
#: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231
msgid "File"
msgstr "Datei"
#: konova/forms.py:267
#: konova/forms.py:262
msgid "Must be smaller than 15 Mb"
msgstr "Muss kleiner als 15 Mb sein"
#: konova/forms.py:278
#: konova/forms.py:273
msgid "Additional comment on this file"
msgstr "Zusätzlicher Kommentar"
@ -710,19 +709,19 @@ msgstr "Wenn meine freigegebenen Daten gelöscht wurden"
msgid "On registered data edited"
msgstr "Wenn meine freigegebenen Daten bearbeitet wurden"
#: konova/models.py:62
#: konova/models.py:61
msgid "Finished"
msgstr "Umgesetzt bis"
#: konova/models.py:63
#: konova/models.py:62
msgid "Maintain"
msgstr "Unterhaltung bis"
#: konova/models.py:64
#: konova/models.py:63
msgid "Control"
msgstr "Kontrolle am"
#: konova/models.py:65
#: konova/models.py:64
msgid "Other"
msgstr "Sonstige"
@ -774,6 +773,18 @@ msgstr "Dokument '{}' gelöscht"
msgid "Deadline removed"
msgstr "Frist gelöscht"
#: news/models.py:11
msgid "Default"
msgstr "Standard"
#: news/models.py:12
msgid "Info"
msgstr ""
#: news/models.py:13
msgid "Warning"
msgstr "Warnung"
#: news/templates/news/dashboard-news.html:12 news/templates/news/index.html:19
msgid "Published on"
msgstr "Veröffentlicht am"
@ -918,6 +929,14 @@ msgstr ""
msgid "User contact data"
msgstr "Kontaktdaten"
#: user/models.py:50
msgid "Created"
msgstr "Erstellt"
#: user/models.py:51
msgid "Deleted"
msgstr "Gelöscht"
#: user/templates/user/includes/contact_modal_button.html:3
msgid "Show contact data"
msgstr "Zeige Kontaktdaten"
@ -2159,9 +2178,6 @@ msgstr ""
#~ msgid "Your own"
#~ msgstr "Eigene"
#~ msgid "Default"
#~ msgstr "Standard"
#~ msgid "Quickstart"
#~ msgstr "Schnellstart"

@ -1,9 +1,18 @@
from django.db import models
from django.utils.translation import gettext_lazy as _
from konova.enums import ServerMessageImportance
from konova.models import BaseResource
class ServerMessageImportance(models.TextChoices):
"""
Defines importance levels for server messages
"""
DEFAULT = "default", _("Default")
INFO = "info", _("Info")
WARNING = "warning", _("Warning")
class ServerMessage(BaseResource):
"""
Holds messages, which can be displayed on the user's dashboard
@ -13,4 +22,4 @@ class ServerMessage(BaseResource):
is_active = models.BooleanField(default=True)
publish_on = models.DateTimeField()
unpublish_on = models.DateTimeField()
importance = models.CharField(max_length=100, choices=ServerMessageImportance.as_choices(drop_empty_choice=True))
importance = models.CharField(max_length=100, choices=ServerMessageImportance.choices)

@ -1,9 +1,9 @@
import uuid
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.models import User
from django.db import models
from konova.enums import UserActionLogEntryEnum
from user.enums import UserNotificationEnum
@ -41,6 +41,16 @@ class KonovaUserExtension(models.Model):
notifications = models.ManyToManyField(UserNotification, related_name="+")
class UserAction(models.TextChoices):
"""
Defines different possible user actions for UserActionLogEntry
"""
CHECKED = "checked", _("Checked")
RECORDED = "recorded", _("Recorded")
CREATED = "created", _("Created")
DELETED = "deleted", _("Deleted")
class UserActionLogEntry(models.Model):
""" Wraps a user action log entry
@ -58,7 +68,7 @@ class UserActionLogEntry(models.Model):
null=True,
blank=True,
help_text="Short name for performed action - optional",
choices=UserActionLogEntryEnum.as_choices(drop_empty_choice=True),
choices=UserAction.choices,
)
def __str__(self):

Loading…
Cancel
Save