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