* adds modal_generic.html template for generic usage
* adds M2M field log to BaseObject
* adds show log button to controls.html
* adds logging on adding related objects
* adds render log table using generic modal
* adds tooltip to missing values in detail views
* adds/updates translations
pull/9/head
mipel 3 years ago
parent f69d98460f
commit 5efa755188

@ -25,6 +25,14 @@ class NewCompensationForm(BaseForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
def save(self):
with transaction.atomic():
user_action = UserActionLogEntry.objects.create(
user=self.user,
action=UserAction.CREATED
)
# Save action to log
class NewPaymentForm(BaseModalForm): class NewPaymentForm(BaseModalForm):
amount = forms.DecimalField( amount = forms.DecimalField(
@ -62,17 +70,23 @@ class NewPaymentForm(BaseModalForm):
def save(self): def save(self):
with transaction.atomic(): with transaction.atomic():
action = UserActionLogEntry.objects.create( created_action = UserActionLogEntry.objects.create(
user=self.user, user=self.user,
action=UserAction.CREATED, action=UserAction.CREATED,
) )
edited_action = UserActionLogEntry.objects.create(
user=self.user,
action=UserAction.EDITED,
comment=_("Added payment"),
)
pay = Payment.objects.create( pay = Payment.objects.create(
created=action, created=created_action,
amount=self.cleaned_data.get("amount", -1), amount=self.cleaned_data.get("amount", -1),
due_on=self.cleaned_data.get("due", None), due_on=self.cleaned_data.get("due", None),
comment=self.cleaned_data.get("transfer_note", None), comment=self.cleaned_data.get("transfer_note", None),
intervention=self.intervention, intervention=self.intervention,
) )
self.intervention.log.add(edited_action)
return pay return pay
@ -99,6 +113,13 @@ class NewStateModalForm(BaseModalForm):
def save(self, is_before_state: bool = False): def save(self, is_before_state: bool = False):
with transaction.atomic(): with transaction.atomic():
user_action = UserActionLogEntry.objects.create(
user=self.user,
action=UserAction.EDITED,
comment=_("Added state")
)
self.instance.log.add(user_action)
state = CompensationState.objects.create( state = CompensationState.objects.create(
biotope_type=self.cleaned_data["biotope_type"], biotope_type=self.cleaned_data["biotope_type"],
surface=self.cleaned_data["surface"], surface=self.cleaned_data["surface"],
@ -196,7 +217,7 @@ class NewDeadlineModalForm(BaseModalForm):
def save(self): def save(self):
with transaction.atomic(): with transaction.atomic():
action = UserActionLogEntry.objects.create( created_action = UserActionLogEntry.objects.create(
user=self.user, user=self.user,
action=UserAction.CREATED action=UserAction.CREATED
) )
@ -204,8 +225,14 @@ class NewDeadlineModalForm(BaseModalForm):
type=self.cleaned_data["type"], type=self.cleaned_data["type"],
date=self.cleaned_data["date"], date=self.cleaned_data["date"],
comment=self.cleaned_data["comment"], comment=self.cleaned_data["comment"],
created=action, created=created_action,
)
edited_action = UserActionLogEntry.objects.create(
user=self.user,
action=UserAction.EDITED,
comment=_("Added deadline")
) )
self.instance.log.add(edited_action)
self.instance.deadlines.add(deadline) self.instance.deadlines.add(deadline)
return deadline return deadline
@ -260,7 +287,7 @@ class NewActionModalForm(BaseModalForm):
with transaction.atomic(): with transaction.atomic():
user_action = UserActionLogEntry.objects.create( user_action = UserActionLogEntry.objects.create(
user=self.user, user=self.user,
action=UserAction.CREATED action=UserAction.CREATED,
) )
comp_action = CompensationAction.objects.create( comp_action = CompensationAction.objects.create(
action_type=self.cleaned_data["action_type"], action_type=self.cleaned_data["action_type"],
@ -269,6 +296,12 @@ class NewActionModalForm(BaseModalForm):
comment=self.cleaned_data["comment"], comment=self.cleaned_data["comment"],
created=user_action, created=user_action,
) )
edited_action = UserActionLogEntry.objects.create(
user=self.user,
action=UserAction.EDITED,
comment=_("Added action"),
)
self.instance.log.add(edited_action)
self.instance.actions.add(comp_action) self.instance.actions.add(comp_action)
return comp_action return comp_action

@ -110,12 +110,12 @@ class AbstractCompensation(BaseObject):
after_states = models.ManyToManyField(CompensationState, blank=True, related_name='+', help_text="Refers to 'Zielzustand Biotop'") after_states = models.ManyToManyField(CompensationState, blank=True, related_name='+', help_text="Refers to 'Zielzustand Biotop'")
actions = models.ManyToManyField(CompensationAction, blank=True, help_text="Refers to 'Maßnahmen'") actions = models.ManyToManyField(CompensationAction, blank=True, help_text="Refers to 'Maßnahmen'")
deadlines = models.ManyToManyField("konova.Deadline", null=True, blank=True, related_name="+") deadlines = models.ManyToManyField("konova.Deadline", blank=True, related_name="+")
geometry = models.ForeignKey(Geometry, null=True, blank=True, on_delete=models.SET_NULL) geometry = models.ForeignKey(Geometry, null=True, blank=True, on_delete=models.SET_NULL)
documents = models.ManyToManyField("konova.Document", blank=True) documents = models.ManyToManyField("konova.Document", blank=True)
# Holds which intervention is simply a newer version of this dataset # Holds a successor for this data
next_version = models.ForeignKey("Compensation", null=True, blank=True, on_delete=models.DO_NOTHING) next_version = models.ForeignKey("Compensation", null=True, blank=True, on_delete=models.DO_NOTHING)
class Meta: class Meta:
@ -172,7 +172,7 @@ class EcoAccount(AbstractCompensation):
# Not needed in regular Compensation since their access is defined by the linked intervention's access # Not needed in regular Compensation since their access is defined by the linked intervention's access
users = models.ManyToManyField( users = models.ManyToManyField(
User, User,
help_text="Users having access" help_text="Users having access (shared with)"
) )
def __str__(self): def __str__(self):

@ -12,15 +12,18 @@
</button> </button>
</a> </a>
{% if has_access %} {% if has_access %}
{% if is_default_member %} {% if is_default_member %}
<a href="{% url 'home' %}" class="mr-2"> <a href="{% url 'home' %}" class="mr-2">
<button class="btn btn-default" title="{% trans 'Edit' %}"> <button class="btn btn-default" title="{% trans 'Edit' %}">
{% fa5_icon 'edit' %} {% fa5_icon 'edit' %}
</button>
</a>
<button class="btn btn-default btn-modal mr-2" data-form-url="{% url 'compensation:log' comp.id %}" title="{% trans 'Show log' %}">
{% fa5_icon 'history' %}
</button> </button>
</a> <button class="btn btn-default btn-modal" data-form-url="{% url 'compensation:remove' comp.id %}" title="{% trans 'Delete' %}">
<button class="btn btn-default btn-modal" data-form-url="{% url 'compensation:remove' comp.id %}" title="{% trans 'Delete' %}"> {% fa5_icon 'trash' %}
{% fa5_icon 'trash' %} </button>
</button> {% endif %}
{% endif %}
{% endif %} {% endif %}
</div> </div>

@ -15,6 +15,7 @@ urlpatterns = [
path("", index_view, name="index"), path("", index_view, name="index"),
path('new', new_view, name='new'), path('new', new_view, name='new'),
path('<id>', open_view, name='open'), path('<id>', open_view, name='open'),
path('<id>/log', log_view, name='log'),
path('<id>/edit', edit_view, name='edit'), path('<id>/edit', edit_view, name='edit'),
path('<id>/remove', remove_view, name='remove'), path('<id>/remove', remove_view, name='remove'),
path('<id>/state/new', state_new_view, name='new-state'), path('<id>/state/new', state_new_view, name='new-state'),

@ -103,6 +103,30 @@ def open_view(request: HttpRequest, id: str):
return render(request, template, context) return render(request, template, context)
@login_required
def log_view(request: HttpRequest, id: str):
""" Renders a log view using modal
Args:
request (HttpRequest): The incoming request
id (str): The compensation's id
Returns:
"""
comp = get_object_or_404(Compensation, id=id)
template = "modal/modal_generic.html"
body_template = "log.html"
context = {
"modal_body_template": body_template,
"log": comp.log.all().order_by("-timestamp"),
"modal_title": _("Log"),
}
context = BaseContext(request, context).context
return render(request, template, context)
@login_required @login_required
def remove_view(request: HttpRequest, id: str): def remove_view(request: HttpRequest, id: str):
""" Renders a modal view for removing the compensation """ Renders a modal view for removing the compensation

@ -133,12 +133,7 @@ class NewInterventionForm(BaseForm):
created=action, created=action,
) )
intervention.save() intervention.save()
for doc in documents: intervention.log.add(action)
doc_obj = Document()
doc_obj.file = doc
# ToDo Add functionality for other attributes
doc_obj.save()
intervention.documents.add(doc_obj)
return intervention return intervention
@ -201,12 +196,12 @@ class EditInterventionForm(NewInterventionForm):
self.instance.geometry = geometry self.instance.geometry = geometry
self.instance.save() self.instance.save()
for doc in documents: user_action = UserActionLogEntry.objects.create(
doc_obj = Document() user=self.user,
doc_obj.document = doc action=UserAction.EDITED
# ToDo Add functionality for other attributes )
doc_obj.save() self.instance.log.add(user_action)
self.instance.documents.add(doc_obj)
return self.instance return self.instance
@ -364,10 +359,14 @@ class NewRevocationForm(BaseModalForm):
def save(self): def save(self):
with transaction.atomic(): with transaction.atomic():
user_action = UserActionLogEntry.objects.create( created_action = UserActionLogEntry.objects.create(
user=self.user, user=self.user,
action=UserAction.CREATED action=UserAction.CREATED
) )
edited_action = UserActionLogEntry.objects.create(
user=self.user,
action=UserAction.EDITED
)
document = Document.objects.create( document = Document.objects.create(
title="revocation_of_{}".format(self.instance.identifier), title="revocation_of_{}".format(self.instance.identifier),
date_of_creation=self.cleaned_data["date"], date_of_creation=self.cleaned_data["date"],
@ -378,8 +377,9 @@ class NewRevocationForm(BaseModalForm):
date=self.cleaned_data["date"], date=self.cleaned_data["date"],
comment=self.cleaned_data["comment"], comment=self.cleaned_data["comment"],
document=document, document=document,
created=user_action, created=created_action,
) )
self.instance.log.add(edited_action)
self.instance.legal.revocation = revocation self.instance.legal.revocation = revocation
self.instance.legal.save() self.instance.legal.save()
return revocation return revocation
@ -421,4 +421,5 @@ class RunCheckForm(BaseModalForm):
if self.instance.checked: if self.instance.checked:
self.instance.checked.delete() self.instance.checked.delete()
self.instance.checked = user_action self.instance.checked = user_action
self.instance.log.add(user_action)
self.instance.save() self.instance.save()

@ -17,7 +17,7 @@ from konova.models import BaseObject, Geometry, UuidModel, BaseResource
from konova.utils import generators from konova.utils import generators
from konova.utils.generators import generate_random_string from konova.utils.generators import generate_random_string
from organisation.models import Organisation from organisation.models import Organisation
from user.models import UserActionLogEntry, UserAction from user.models import UserActionLogEntry
class ResponsibilityData(UuidModel): class ResponsibilityData(UuidModel):
@ -123,7 +123,7 @@ class Intervention(BaseObject):
next_version = models.ForeignKey("Intervention", null=True, blank=True, on_delete=models.DO_NOTHING) next_version = models.ForeignKey("Intervention", null=True, blank=True, on_delete=models.DO_NOTHING)
# Users having access on this object # Users having access on this object
users = models.ManyToManyField(User) users = models.ManyToManyField(User, help_text="Users having access (data shared with)")
access_token = models.CharField( access_token = models.CharField(
max_length=255, max_length=255,
null=True, null=True,

@ -27,15 +27,18 @@
</button> </button>
</a> </a>
{% endif %} {% endif %}
{% if is_default_member %} {% if is_default_member %}
<a href="{% url 'home' %}" class="mr-2"> <a href="{% url 'home' %}" class="mr-2">
<button class="btn btn-default" title="{% trans 'Edit' %}"> <button class="btn btn-default" title="{% trans 'Edit' %}">
{% fa5_icon 'edit' %} {% fa5_icon 'edit' %}
</button>
</a>
<button class="btn btn-default btn-modal mr-2" data-form-url="{% url 'intervention:log' intervention.id %}" title="{% trans 'Show log' %}">
{% fa5_icon 'history' %}
</button> </button>
</a> <button class="btn btn-default btn-modal" data-form-url="{% url 'intervention:remove' intervention.id %}" title="{% trans 'Delete' %}">
<button class="btn btn-default btn-modal" data-form-url="{% url 'intervention:remove' intervention.id %}" title="{% trans 'Delete' %}"> {% fa5_icon 'trash' %}
{% fa5_icon 'trash' %} </button>
</button> {% endif %}
{% endif %}
{% endif %} {% endif %}
</div> </div>

@ -20,15 +20,15 @@
<div class="col-sm-12 col-md-12 col-lg-6"> <div class="col-sm-12 col-md-12 col-lg-6">
<div class="table-container"> <div class="table-container">
<table class="table table-hover"> <table class="table table-hover">
<tr {% if not intervention.title %}class="alert alert-danger"{% endif %}> <tr {% if not intervention.title %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
<th class="w-25" scope="row">{% trans 'Title' %}</th> <th class="w-25" scope="row">{% trans 'Title' %}</th>
<td class="align-middle">{{intervention.title|default_if_none:""}}</td> <td class="align-middle">{{intervention.title|default_if_none:""}}</td>
</tr> </tr>
<tr {% if not intervention.legal.process_type %}class="alert alert-danger"{% endif %}> <tr {% if not intervention.legal.process_type %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
<th scope="row">{% trans 'Process type' %}</th> <th scope="row">{% trans 'Process type' %}</th>
<td class="align-middle">{{intervention.legal.process_type|default_if_none:""}}</td> <td class="align-middle">{{intervention.legal.process_type|default_if_none:""}}</td>
</tr> </tr>
<tr {% if not intervention.legal.law %}class="alert alert-danger"{% endif %}> <tr {% if not intervention.legal.law %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
<th scope="row">{% trans 'Law' %}</th> <th scope="row">{% trans 'Law' %}</th>
<td class="align-middle">{{intervention.legal.law|default_if_none:""}}</td> <td class="align-middle">{{intervention.legal.law|default_if_none:""}}</td>
</tr> </tr>
@ -36,7 +36,7 @@
<th scope="row">{% trans 'Registration office' %}</th> <th scope="row">{% trans 'Registration office' %}</th>
<td class="align-middle">{{intervention.responsible.registration_office|default_if_none:""}}</td> <td class="align-middle">{{intervention.responsible.registration_office|default_if_none:""}}</td>
</tr> </tr>
<tr {% if not intervention.responsible.registration_file_number %}class="alert alert-danger"{% endif %}> <tr {% if not intervention.responsible.registration_file_number %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
<th scope="row">{% trans 'Registration office file number' %}</th> <th scope="row">{% trans 'Registration office file number' %}</th>
<td class="align-middle">{{intervention.responsible.registration_file_number|default_if_none:""}}</td> <td class="align-middle">{{intervention.responsible.registration_file_number|default_if_none:""}}</td>
</tr> </tr>
@ -48,7 +48,7 @@
<th scope="row">{% trans 'Conversation office file number' %}</th> <th scope="row">{% trans 'Conversation office file number' %}</th>
<td class="align-middle">{{intervention.responsible.conservation_file_number|default_if_none:""}}</td> <td class="align-middle">{{intervention.responsible.conservation_file_number|default_if_none:""}}</td>
</tr> </tr>
<tr {% if not intervention.responsible.handler %}class="alert alert-danger"{% endif %}> <tr {% if not intervention.responsible.handler %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
<th scope="row">{% trans 'Intervention handler' %}</th> <th scope="row">{% trans 'Intervention handler' %}</th>
<td class="align-middle">{{intervention.responsible.handler|default_if_none:""}}</td> <td class="align-middle">{{intervention.responsible.handler|default_if_none:""}}</td>
</tr> </tr>
@ -80,15 +80,15 @@
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
<tr {% if not intervention.legal.registration_date %}class="alert alert-danger"{% endif %}> <tr {% if not intervention.legal.registration_date %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
<th scope="row">{% trans 'Registration date' %}</th> <th scope="row">{% trans 'Registration date' %}</th>
<td class="align-middle">{{intervention.legal.registration_date|default_if_none:""}}</td> <td class="align-middle">{{intervention.legal.registration_date|default_if_none:""}}</td>
</tr> </tr>
<tr {% if not intervention.legal.binding_date %}class="alert alert-danger"{% endif %}> <tr {% if not intervention.legal.binding_date %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
<th scope="row">{% trans 'Binding on' %}</th> <th scope="row">{% trans 'Binding on' %}</th>
<td class="align-middle">{{intervention.legal.binding_date|default_if_none:""}}</td> <td class="align-middle">{{intervention.legal.binding_date|default_if_none:""}}</td>
</tr> </tr>
<tr {% if intervention.legal.revocation %}class="alert alert-danger"{% endif %}> <tr {% if intervention.legal.revocation %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
<th scope="row">{% trans 'Revocation' %}</th> <th scope="row">{% trans 'Revocation' %}</th>
<td class="align-middle">{{intervention.legal.revocation.date|naturalday|default_if_none:""}}</td> <td class="align-middle">{{intervention.legal.revocation.date|naturalday|default_if_none:""}}</td>
</tr> </tr>

@ -8,7 +8,7 @@ Created on: 30.11.20
from django.urls import path from django.urls import path
from intervention.views import index_view, new_view, open_view, edit_view, remove_view, new_document_view, share_view, \ from intervention.views import index_view, new_view, open_view, edit_view, remove_view, new_document_view, share_view, \
create_share_view, remove_revocation_view, new_revocation_view, run_check_view create_share_view, remove_revocation_view, new_revocation_view, run_check_view, log_view
app_name = "intervention" app_name = "intervention"
urlpatterns = [ urlpatterns = [
@ -16,6 +16,7 @@ urlpatterns = [
path('new/', new_view, name='new'), path('new/', new_view, name='new'),
path('<id>/document/new/', new_document_view, name='new-doc'), path('<id>/document/new/', new_document_view, name='new-doc'),
path('<id>', open_view, name='open'), path('<id>', open_view, name='open'),
path('<id>/log', log_view, name='log'),
path('<id>/edit', edit_view, name='edit'), path('<id>/edit', edit_view, name='edit'),
path('<id>/remove', remove_view, name='remove'), path('<id>/remove', remove_view, name='remove'),
path('<id>/share/<token>', share_view, name='share'), path('<id>/share/<token>', share_view, name='share'),

@ -370,3 +370,25 @@ def new_revocation_view(request: HttpRequest, id: str):
raise NotImplementedError raise NotImplementedError
@login_required
def log_view(request: HttpRequest, id: str):
""" Renders a log view using modal
Args:
request (HttpRequest): The incoming request
id (str): The compensation's id
Returns:
"""
intervention = get_object_or_404(Intervention, id=id)
template = "modal/modal_generic.html"
body_template = "log.html"
context = {
"modal_body_template": body_template,
"log": intervention.log.all().order_by("-timestamp"),
"modal_title": _("Log"),
}
context = BaseContext(request, context).context
return render(request, template, context)

@ -21,7 +21,7 @@ from django.utils import timezone
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from konova.contexts import BaseContext from konova.contexts import BaseContext
from konova.models import Document from konova.models import Document, BaseObject
from konova.utils.message_templates import FORM_INVALID from konova.utils.message_templates import FORM_INVALID
from user.models import UserActionLogEntry, UserAction from user.models import UserActionLogEntry, UserAction
@ -236,14 +236,16 @@ class RemoveModalForm(BaseModalForm):
self.form_caption = _("Are you sure?") self.form_caption = _("Are you sure?")
def save(self): def save(self):
if hasattr(self.instance, "deleted"): if isinstance(self.instance, BaseObject):
action = UserActionLogEntry.objects.create( with transaction.atomic():
user=self.user, action = UserActionLogEntry.objects.create(
timestamp=timezone.now(), user=self.user,
action=UserAction.DELETED, timestamp=timezone.now(),
) action=UserAction.DELETED,
self.instance.deleted = action )
self.instance.save() self.instance.deleted = action
self.instance.log.add(action)
self.instance.save()
else: else:
# If the class does not provide restorable delete functionality, we must delete the entry finally # If the class does not provide restorable delete functionality, we must delete the entry finally
self.instance.delete() self.instance.delete()
@ -317,4 +319,12 @@ class NewDocumentForm(BaseModalForm):
date_of_creation=self.cleaned_data["creation_date"], date_of_creation=self.cleaned_data["creation_date"],
) )
self.instance.documents.add(doc) self.instance.documents.add(doc)
edited_action = UserActionLogEntry.objects.create(
user=self.user,
action=UserAction.EDITED,
comment=_("Added document"),
)
self.instance.log.add(edited_action)
return doc return doc

@ -8,6 +8,7 @@ Created on: 17.11.20
import os import os
import uuid import uuid
from django.contrib.auth.models import User
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.contrib.gis.db.models import MultiPolygonField from django.contrib.gis.db.models import MultiPolygonField
from django.db import models, transaction from django.db import models, transaction
@ -54,6 +55,7 @@ class BaseObject(BaseResource):
title = models.CharField(max_length=1000, null=True, blank=True) title = models.CharField(max_length=1000, null=True, blank=True)
deleted = models.ForeignKey(UserActionLogEntry, on_delete=models.SET_NULL, null=True, blank=True, related_name='+') deleted = models.ForeignKey(UserActionLogEntry, on_delete=models.SET_NULL, null=True, blank=True, related_name='+')
comment = models.TextField(null=True, blank=True) comment = models.TextField(null=True, blank=True)
log = models.ManyToManyField(UserActionLogEntry, blank=True, help_text="Keeps all user actions of an object", editable=False)
class Meta: class Meta:
abstract = True abstract = True
@ -83,6 +85,23 @@ class BaseObject(BaseResource):
self.deleted = action self.deleted = action
self.save() self.save()
def add_log_entry(self, action: UserAction, user: User, comment: str):
""" Wraps adding of UserActionLogEntry to self.log
Args:
action (UserAction): The performed UserAction
user (User): Performing user
Returns:
"""
user_action = UserActionLogEntry.objects.create(
user=user,
action=action,
comment=comment
)
self.log.add(user_action)
class DeadlineType(models.TextChoices): class DeadlineType(models.TextChoices):
""" """

Binary file not shown.

@ -3,20 +3,20 @@
# This file is distributed under the same license as the PACKAGE package. # This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# #
#: compensation/forms.py:34 compensation/forms.py:39 compensation/forms.py:52 #: compensation/forms.py:42 compensation/forms.py:47 compensation/forms.py:60
#: compensation/forms.py:182 compensation/forms.py:244 #: compensation/forms.py:203 compensation/forms.py:271
#: intervention/filters.py:26 intervention/filters.py:40 #: intervention/filters.py:26 intervention/filters.py:40
#: intervention/filters.py:47 intervention/filters.py:48 #: intervention/filters.py:47 intervention/filters.py:48
#: intervention/forms.py:323 intervention/forms.py:335 #: intervention/forms.py:318 intervention/forms.py:330
#: intervention/forms.py:347 konova/forms.py:91 konova/forms.py:227 #: intervention/forms.py:342 konova/forms.py:92 konova/forms.py:228
#: konova/forms.py:258 konova/forms.py:263 konova/forms.py:275 #: konova/forms.py:261 konova/forms.py:266 konova/forms.py:278
#: konova/forms.py:287 konova/forms.py:300 user/forms.py:38 #: konova/forms.py:290 konova/forms.py:303 user/forms.py:38
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-04 15:12+0200\n" "POT-Creation-Date: 2021-08-05 12:43+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -26,140 +26,156 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: compensation/forms.py:33 compensation/forms.py:233 #: compensation/forms.py:41 compensation/forms.py:260
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:33 #: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:33
msgid "Amount" msgid "Amount"
msgstr "Menge" msgstr "Menge"
#: compensation/forms.py:35 #: compensation/forms.py:43
msgid "Amount in Euro" msgid "Amount in Euro"
msgstr "Betrag in Euro" msgstr "Betrag in Euro"
#: compensation/forms.py:38 #: compensation/forms.py:46
#: intervention/templates/intervention/detail/includes/payments.html:31 #: intervention/templates/intervention/detail/includes/payments.html:31
msgid "Due on" msgid "Due on"
msgstr "Fällig am" msgstr "Fällig am"
#: compensation/forms.py:40 #: compensation/forms.py:48
msgid "Due on which date" msgid "Due on which date"
msgstr "Zahlung wird an diesem Datum erwartet" msgstr "Zahlung wird an diesem Datum erwartet"
#: compensation/forms.py:53 #: compensation/forms.py:61
msgid "Transfer note" msgid "Transfer note"
msgstr "Verwendungszweck" msgstr "Verwendungszweck"
#: compensation/forms.py:54 #: compensation/forms.py:62
msgid "Note for money transfer" msgid "Note for money transfer"
msgstr "Verwendungszweck für Überweisung" msgstr "Verwendungszweck für Überweisung"
#: compensation/forms.py:60 #: compensation/forms.py:68
msgid "Payment" msgid "Payment"
msgstr "Zahlung" msgstr "Zahlung"
#: compensation/forms.py:61 #: compensation/forms.py:69
msgid "Add a payment for intervention '{}'" msgid "Add a payment for intervention '{}'"
msgstr "Neue Ersatzzahlung zu Eingriff '{}' hinzufügen" msgstr "Neue Ersatzzahlung zu Eingriff '{}' hinzufügen"
#: compensation/forms.py:81 #: compensation/forms.py:80
msgid "Added payment"
msgstr "Zahlung hinzufügen"
#: compensation/forms.py:95
msgid "Biotope Type" msgid "Biotope Type"
msgstr "Biotoptyp" msgstr "Biotoptyp"
#: compensation/forms.py:84 #: compensation/forms.py:98
msgid "Select the biotope type" msgid "Select the biotope type"
msgstr "Biotoptyp wählen" msgstr "Biotoptyp wählen"
#: compensation/forms.py:89 #: compensation/forms.py:103
#: compensation/templates/compensation/detail/includes/states-after.html:36 #: compensation/templates/compensation/detail/includes/states-after.html:36
#: compensation/templates/compensation/detail/includes/states-before.html:36 #: compensation/templates/compensation/detail/includes/states-before.html:36
msgid "Surface" msgid "Surface"
msgstr "Fläche" msgstr "Fläche"
#: compensation/forms.py:92 #: compensation/forms.py:106
msgid "in m²" msgid "in m²"
msgstr "" msgstr ""
#: compensation/forms.py:97 #: compensation/forms.py:111
msgid "New state" msgid "New state"
msgstr "Neuer Zustand" msgstr "Neuer Zustand"
#: compensation/forms.py:98 #: compensation/forms.py:112
msgid "Insert data for the new state" msgid "Insert data for the new state"
msgstr "Geben Sie die Daten des neuen Zustandes ein" msgstr "Geben Sie die Daten des neuen Zustandes ein"
#: compensation/forms.py:112 konova/forms.py:141 #: compensation/forms.py:119
msgid "Added state"
msgstr "Zustand hinzugefügt"
#: compensation/forms.py:133 konova/forms.py:142
msgid "Object removed" msgid "Object removed"
msgstr "Objekt entfernt" msgstr "Objekt entfernt"
#: compensation/forms.py:154 #: compensation/forms.py:175
msgid "Deadline Type" msgid "Deadline Type"
msgstr "Fristart" msgstr "Fristart"
#: compensation/forms.py:157 #: compensation/forms.py:178
msgid "Select the deadline type" msgid "Select the deadline type"
msgstr "Fristart wählen" msgstr "Fristart wählen"
#: compensation/forms.py:166 #: compensation/forms.py:187
#: compensation/templates/compensation/detail/includes/deadlines.html:31 #: compensation/templates/compensation/detail/includes/deadlines.html:31
#: intervention/forms.py:322 #: intervention/forms.py:317
msgid "Date" msgid "Date"
msgstr "Datum" msgstr "Datum"
#: compensation/forms.py:169 #: compensation/forms.py:190
msgid "Select date" msgid "Select date"
msgstr "Datum wählen" msgstr "Datum wählen"
#: compensation/forms.py:181 compensation/forms.py:243 #: compensation/forms.py:202 compensation/forms.py:270
#: compensation/templates/compensation/detail/includes/actions.html:34 #: compensation/templates/compensation/detail/includes/actions.html:34
#: compensation/templates/compensation/detail/includes/deadlines.html:34 #: compensation/templates/compensation/detail/includes/deadlines.html:34
#: compensation/templates/compensation/detail/includes/documents.html:31 #: compensation/templates/compensation/detail/includes/documents.html:31
#: intervention/forms.py:346 #: intervention/forms.py:341
#: intervention/templates/intervention/detail/includes/documents.html:31 #: intervention/templates/intervention/detail/includes/documents.html:31
#: intervention/templates/intervention/detail/includes/revocation.html:35 #: intervention/templates/intervention/detail/includes/revocation.html:35
#: konova/forms.py:286 #: konova/forms.py:289
msgid "Comment" msgid "Comment"
msgstr "Kommentar" msgstr "Kommentar"
#: compensation/forms.py:183 compensation/forms.py:245 #: compensation/forms.py:204 compensation/forms.py:272
#: intervention/forms.py:348 konova/forms.py:288 #: intervention/forms.py:343 konova/forms.py:291
msgid "Additional comment, maximum {} letters" msgid "Additional comment, maximum {} letters"
msgstr "Zusätzlicher Kommentar, maximal {} Zeichen" msgstr "Zusätzlicher Kommentar, maximal {} Zeichen"
#: compensation/forms.py:194 #: compensation/forms.py:215
msgid "New deadline" msgid "New deadline"
msgstr "Neue Frist" msgstr "Neue Frist"
#: compensation/forms.py:195 #: compensation/forms.py:216
msgid "Insert data for the new deadline" msgid "Insert data for the new deadline"
msgstr "Geben Sie die Daten der neuen Frist ein" msgstr "Geben Sie die Daten der neuen Frist ein"
#: compensation/forms.py:215 #: compensation/forms.py:233
msgid "Added deadline"
msgstr "Frist/Termin hinzugefügt"
#: compensation/forms.py:242
msgid "Action Type" msgid "Action Type"
msgstr "Maßnahmentyp" msgstr "Maßnahmentyp"
#: compensation/forms.py:218 #: compensation/forms.py:245
msgid "Select the action type" msgid "Select the action type"
msgstr "Maßnahmentyp wählen" msgstr "Maßnahmentyp wählen"
#: compensation/forms.py:221 #: compensation/forms.py:248
msgid "Unit" msgid "Unit"
msgstr "Einheit" msgstr "Einheit"
#: compensation/forms.py:224 #: compensation/forms.py:251
msgid "Select the unit" msgid "Select the unit"
msgstr "Einheit wählen" msgstr "Einheit wählen"
#: compensation/forms.py:236 #: compensation/forms.py:263
msgid "Insert the amount" msgid "Insert the amount"
msgstr "Menge eingeben" msgstr "Menge eingeben"
#: compensation/forms.py:256 #: compensation/forms.py:283
msgid "New action" msgid "New action"
msgstr "Neue Maßnahme" msgstr "Neue Maßnahme"
#: compensation/forms.py:257 #: compensation/forms.py:284
msgid "Insert data for the new action" msgid "Insert data for the new action"
msgstr "Geben Sie die Daten der neuen Maßnahme ein" msgstr "Geben Sie die Daten der neuen Maßnahme ein"
#: compensation/forms.py:302
msgid "Added action"
msgstr "Maßnahme hinzugefügt"
#: compensation/models.py:59 #: compensation/models.py:59
msgid "cm" msgid "cm"
msgstr "" msgstr ""
@ -196,7 +212,7 @@ msgstr "Kennung"
#: intervention/forms.py:35 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/compensations.html:33
#: intervention/templates/intervention/detail/includes/documents.html:28 #: intervention/templates/intervention/detail/includes/documents.html:28
#: intervention/templates/intervention/detail/view.html:24 konova/forms.py:257 #: intervention/templates/intervention/detail/view.html:24 konova/forms.py:260
msgid "Title" msgid "Title"
msgstr "Bezeichnung" msgstr "Bezeichnung"
@ -265,7 +281,7 @@ msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden"
msgid "Access not granted" msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar" msgstr "Nicht freigegeben - Datensatz nur lesbar"
#: compensation/tables.py:174 konova/forms.py:262 #: compensation/tables.py:174 konova/forms.py:265
msgid "Created on" msgid "Created on"
msgstr "Erstellt" msgstr "Erstellt"
@ -313,6 +329,7 @@ msgstr "Menge"
#: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:36 #: intervention/templates/intervention/detail/includes/eco-account-withdraws.html:36
#: intervention/templates/intervention/detail/includes/payments.html:37 #: intervention/templates/intervention/detail/includes/payments.html:37
#: intervention/templates/intervention/detail/includes/revocation.html:41 #: intervention/templates/intervention/detail/includes/revocation.html:41
#: templates/log.html:10
msgid "Action" msgid "Action"
msgstr "Aktionen" msgstr "Aktionen"
@ -336,6 +353,10 @@ msgid "Edit"
msgstr "Bearbeiten" msgstr "Bearbeiten"
#: compensation/templates/compensation/detail/includes/controls.html:21 #: compensation/templates/compensation/detail/includes/controls.html:21
msgid "Show log"
msgstr "Log anzeigen"
#: compensation/templates/compensation/detail/includes/controls.html:24
#: intervention/templates/intervention/detail/includes/controls.html:36 #: intervention/templates/intervention/detail/includes/controls.html:36
#: venv/lib/python3.7/site-packages/django/forms/formsets.py:391 #: venv/lib/python3.7/site-packages/django/forms/formsets.py:391
msgid "Delete" msgid "Delete"
@ -365,7 +386,7 @@ msgstr "Dokumente"
#: compensation/templates/compensation/detail/includes/documents.html:14 #: compensation/templates/compensation/detail/includes/documents.html:14
#: intervention/templates/intervention/detail/includes/documents.html:14 #: intervention/templates/intervention/detail/includes/documents.html:14
#: konova/forms.py:299 #: konova/forms.py:302
msgid "Add new document" msgid "Add new document"
msgstr "Neues Dokument hinzufügen" msgstr "Neues Dokument hinzufügen"
@ -434,54 +455,58 @@ msgstr "Verzeichnet am"
msgid "Last modified" msgid "Last modified"
msgstr "Zuletzt bearbeitet" msgstr "Zuletzt bearbeitet"
#: compensation/templates/compensation/detail/view.html:74 #: compensation/templates/compensation/detail/view.html:72
#: intervention/forms.py:256 #: intervention/forms.py:251
#: intervention/templates/intervention/detail/view.html:106 #: intervention/templates/intervention/detail/view.html:104
msgid "Shared with" msgid "Shared with"
msgstr "Freigegeben für" msgstr "Freigegeben für"
#: compensation/templates/compensation/detail/view.html:86 #: compensation/templates/compensation/detail/view.html:84
#: intervention/templates/intervention/detail/view.html:118 #: intervention/templates/intervention/detail/view.html:116
msgid "No geometry added, yet." msgid "No geometry added, yet."
msgstr "Keine Geometrie vorhanden" msgstr "Keine Geometrie vorhanden"
#: compensation/views.py:121 #: compensation/views.py:127
msgid "Log"
msgstr "Log"
#: compensation/views.py:148
msgid "Compensation removed" msgid "Compensation removed"
msgstr "Kompensation entfernt" msgstr "Kompensation entfernt"
#: compensation/views.py:201 #: compensation/views.py:228
msgid "Payment added" msgid "Payment added"
msgstr "Zahlung hinzugefügt" msgstr "Zahlung hinzugefügt"
#: compensation/views.py:236 #: compensation/views.py:263
msgid "Payment removed" msgid "Payment removed"
msgstr "Zahlung gelöscht" msgstr "Zahlung gelöscht"
#: compensation/views.py:262 #: compensation/views.py:289
msgid "Withdraw removed" msgid "Withdraw removed"
msgstr "Abbuchung entfernt" msgstr "Abbuchung entfernt"
#: compensation/views.py:280 intervention/views.py:96 #: compensation/views.py:307 intervention/views.py:96
msgid "Document added" msgid "Document added"
msgstr "Dokument hinzugefügt" msgstr "Dokument hinzugefügt"
#: compensation/views.py:299 #: compensation/views.py:326
msgid "State added" msgid "State added"
msgstr "Zustand hinzugefügt" msgstr "Zustand hinzugefügt"
#: compensation/views.py:318 #: compensation/views.py:345
msgid "Action added" msgid "Action added"
msgstr "Maßnahme hinzugefügt" msgstr "Maßnahme hinzugefügt"
#: compensation/views.py:337 #: compensation/views.py:364
msgid "Deadline added" msgid "Deadline added"
msgstr "Frist hinzugefügt" msgstr "Frist hinzugefügt"
#: compensation/views.py:356 #: compensation/views.py:383
msgid "State removed" msgid "State removed"
msgstr "Zustand gelöscht" msgstr "Zustand gelöscht"
#: compensation/views.py:375 #: compensation/views.py:402
msgid "Action removed" msgid "Action removed"
msgstr "Maßnahme entfernt" msgstr "Maßnahme entfernt"
@ -563,45 +588,45 @@ msgstr "Dateien"
msgid "New intervention" msgid "New intervention"
msgstr "Neuer Eingriff" msgstr "Neuer Eingriff"
#: intervention/forms.py:151 #: intervention/forms.py:146
msgid "Edit intervention" msgid "Edit intervention"
msgstr "Eingriff bearbeiten" msgstr "Eingriff bearbeiten"
#: intervention/forms.py:245 #: intervention/forms.py:240
msgid "Share link" msgid "Share link"
msgstr "Freigabelink" msgstr "Freigabelink"
#: intervention/forms.py:247 #: intervention/forms.py:242
msgid "Send this link to users who you want to have writing access on the data" 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" msgstr "Andere Nutzer erhalten über diesen Link Zugriff auf die Daten"
#: intervention/forms.py:259 #: intervention/forms.py:254
msgid "Remove check to remove access for this user" msgid "Remove check to remove access for this user"
msgstr "Wählen Sie die Nutzer ab, die keinen Zugriff mehr haben sollen" msgstr "Wählen Sie die Nutzer ab, die keinen Zugriff mehr haben sollen"
#: intervention/forms.py:270 #: intervention/forms.py:265
#: intervention/templates/intervention/detail/includes/controls.html:15 #: intervention/templates/intervention/detail/includes/controls.html:15
msgid "Share" msgid "Share"
msgstr "Freigabe" msgstr "Freigabe"
#: intervention/forms.py:271 #: intervention/forms.py:266
msgid "Share settings for {}" msgid "Share settings for {}"
msgstr "Freigabe Einstellungen für {}" msgstr "Freigabe Einstellungen für {}"
#: intervention/forms.py:324 #: intervention/forms.py:319
msgid "Date of revocation" msgid "Date of revocation"
msgstr "Datum des Widerspruchs" msgstr "Datum des Widerspruchs"
#: intervention/forms.py:334 #: intervention/forms.py:329
#: intervention/templates/intervention/detail/includes/revocation.html:38 #: intervention/templates/intervention/detail/includes/revocation.html:38
msgid "Document" msgid "Document"
msgstr "Dokument" msgstr "Dokument"
#: intervention/forms.py:336 konova/forms.py:276 #: intervention/forms.py:331 konova/forms.py:279
msgid "Must be smaller than 15 Mb" msgid "Must be smaller than 15 Mb"
msgstr "Muss kleiner als 15 Mb sein" msgstr "Muss kleiner als 15 Mb sein"
#: intervention/forms.py:359 #: intervention/forms.py:354
#: intervention/templates/intervention/detail/includes/revocation.html:18 #: intervention/templates/intervention/detail/includes/revocation.html:18
msgid "Add revocation" msgid "Add revocation"
msgstr "Widerspruch hinzufügen" msgstr "Widerspruch hinzufügen"
@ -823,35 +848,39 @@ msgstr ""
msgid "You need to be part of another user group." msgid "You need to be part of another user group."
msgstr "Hierfür müssen Sie einer anderen Nutzergruppe angehören!" msgstr "Hierfür müssen Sie einer anderen Nutzergruppe angehören!"
#: konova/forms.py:64 #: konova/forms.py:65
msgid "Not editable" msgid "Not editable"
msgstr "Nicht editierbar" msgstr "Nicht editierbar"
#: konova/forms.py:90 konova/forms.py:226 #: konova/forms.py:91 konova/forms.py:227
msgid "Confirm" msgid "Confirm"
msgstr "Bestätige" msgstr "Bestätige"
#: konova/forms.py:102 konova/forms.py:235 #: konova/forms.py:103 konova/forms.py:236
msgid "Remove" msgid "Remove"
msgstr "Löschen" msgstr "Löschen"
#: konova/forms.py:104 #: konova/forms.py:105
msgid "You are about to remove {} {}" msgid "You are about to remove {} {}"
msgstr "Sie sind dabei {} {} zu löschen" msgstr "Sie sind dabei {} {} zu löschen"
#: konova/forms.py:236 #: konova/forms.py:237
msgid "Are you sure?" msgid "Are you sure?"
msgstr "Sind Sie sicher?" msgstr "Sind Sie sicher?"
#: konova/forms.py:264 #: konova/forms.py:267
msgid "When has this file been created? Important for photos." msgid "When has this file been created? Important for photos."
msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?" msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?"
#: konova/forms.py:274 #: konova/forms.py:277
#: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231 #: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231
msgid "File" msgid "File"
msgstr "Datei" msgstr "Datei"
#: konova/forms.py:327
msgid "Added document"
msgstr "Dokument hinzugefügt"
#: konova/management/commands/setup_data.py:42 #: konova/management/commands/setup_data.py:42
msgid "On new related data" msgid "On new related data"
msgstr "Wenn neue Daten für mich angelegt werden" msgstr "Wenn neue Daten für mich angelegt werden"
@ -876,19 +905,19 @@ msgstr "Wenn meine freigegebenen Daten gelöscht wurden"
msgid "On registered data edited" msgid "On registered data edited"
msgstr "Wenn meine freigegebenen Daten bearbeitet wurden" msgstr "Wenn meine freigegebenen Daten bearbeitet wurden"
#: konova/models.py:92 #: konova/models.py:110
msgid "Finished" msgid "Finished"
msgstr "Umgesetzt bis" msgstr "Umgesetzt bis"
#: konova/models.py:93 #: konova/models.py:111
msgid "Maintain" msgid "Maintain"
msgstr "Unterhaltung bis" msgstr "Unterhaltung bis"
#: konova/models.py:94 #: konova/models.py:112
msgid "Control" msgid "Control"
msgstr "Kontrolle am" msgstr "Kontrolle am"
#: konova/models.py:95 #: konova/models.py:113
msgid "Other" msgid "Other"
msgstr "Sonstige" msgstr "Sonstige"
@ -1012,6 +1041,14 @@ msgstr ""
msgid "Apply filter" msgid "Apply filter"
msgstr "Filter anwenden" msgstr "Filter anwenden"
#: templates/log.html:7
msgid "Timestamp"
msgstr ""
#: templates/log.html:13
msgid "User"
msgstr "Nutzer"
#: templates/modal/modal_form.html:25 #: templates/modal/modal_form.html:25
msgid "Continue" msgid "Continue"
msgstr "Weiter" msgstr "Weiter"
@ -1101,6 +1138,10 @@ msgid "Created"
msgstr "Erstellt" msgstr "Erstellt"
#: user/models.py:51 #: user/models.py:51
msgid "Edited"
msgstr "Bearbeitet"
#: user/models.py:52
msgid "Deleted" msgid "Deleted"
msgstr "Gelöscht" msgstr "Gelöscht"
@ -2342,9 +2383,6 @@ msgstr ""
#~ msgid "Missing surfaces: " #~ msgid "Missing surfaces: "
#~ msgstr "Fehlende Flächen: " #~ msgstr "Fehlende Flächen: "
#~ msgid "Show all"
#~ msgstr "Alle anzeigen"
#~ msgid "This will remove '{}'. Are you sure?" #~ msgid "This will remove '{}'. Are you sure?"
#~ msgstr "Hiermit wird '{}' gelöscht. Sind Sie sicher?" #~ msgstr "Hiermit wird '{}' gelöscht. Sind Sie sicher?"

@ -0,0 +1,33 @@
{% load i18n %}
<div class="table-container scroll-300">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">
{% trans 'Timestamp' %}
</th>
<th scope="col">
{% trans 'Action' %}
</th>
<th scope="col">
{% trans 'User' %}
</th>
</tr>
</thead>
<tbody>
{% for entry in log %}
<tr>
<td>
{{entry.timestamp}}
</td>
<td>
{{ entry.action_humanize}}
</td>
<td>
{{entry.user}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>

@ -0,0 +1,17 @@
{% load i18n l10n %}
{% comment %}
A generic modal template which is derived from modal_form.html on django-bootstrap-modal-forms package
https://pypi.org/project/django-bootstrap-modal-forms/
{% endcomment %}
<div class="modal-header">
<h5 class="modal-title">{{ modal_title }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include modal_body_template %}
</div>

@ -48,6 +48,7 @@ class UserAction(models.TextChoices):
CHECKED = "checked", _("Checked") CHECKED = "checked", _("Checked")
RECORDED = "recorded", _("Recorded") RECORDED = "recorded", _("Recorded")
CREATED = "created", _("Created") CREATED = "created", _("Created")
EDITED = "edited", _("Edited")
DELETED = "deleted", _("Deleted") DELETED = "deleted", _("Deleted")
@ -70,6 +71,22 @@ class UserActionLogEntry(models.Model):
help_text="Short name for performed action - optional", help_text="Short name for performed action - optional",
choices=UserAction.choices, choices=UserAction.choices,
) )
comment = models.CharField(max_length=255, null=True, blank=True, help_text="Additional comment on this entry")
def __str__(self): def __str__(self):
return "{} | {} | {}".format(self.user.username, self.timestamp, self.action) return "{} | {} | {}".format(self.user.username, self.timestamp, self.action)
@property
def action_humanize(self):
""" Returns humanized version of enum
Used for template rendering
Returns:
"""
choices = UserAction.choices
for choice in choices:
if choice[0] == self.action:
return choice[1]
return None

Loading…
Cancel
Save