# 86 More log details Documents
* adds more log details on adding/removing documents * fixes bug in admin backend where restoring of non-compensation entries led to an error * fixes bug where deleting of revocation without an attached file would lead to an error
This commit is contained in:
@@ -3,6 +3,8 @@ from django.contrib import admin
|
||||
from compensation.models import Compensation, CompensationAction, CompensationState, Payment, \
|
||||
EcoAccountDeduction, EcoAccount
|
||||
from konova.admin import BaseObjectAdmin, BaseResourceAdmin
|
||||
from konova.utils.message_templates import COMPENSATION_REMOVED_TEMPLATE
|
||||
from user.models import UserAction
|
||||
|
||||
|
||||
class AbstractCompensationAdmin(BaseObjectAdmin):
|
||||
@@ -42,6 +44,17 @@ class CompensationAdmin(AbstractCompensationAdmin):
|
||||
"intervention",
|
||||
]
|
||||
|
||||
def restore_deleted_data(self, request, queryset):
|
||||
super().restore_deleted_data(request, queryset)
|
||||
|
||||
for entry in queryset:
|
||||
# Remove delete log entry from related intervention log history
|
||||
logs = entry.intervention.log.filter(
|
||||
action=UserAction.EDITED,
|
||||
comment=COMPENSATION_REMOVED_TEMPLATE.format(entry.identifier)
|
||||
)
|
||||
logs.delete()
|
||||
|
||||
|
||||
class EcoAccountAdmin(AbstractCompensationAdmin):
|
||||
list_display = [
|
||||
|
||||
Reference in New Issue
Block a user