konova/process/admin.py
2021-07-01 13:36:07 +02:00

39 lines
842 B
Python

from django.contrib import admin
from process.models import Process
def activate_process(modeladmin, request, queryset):
for process in queryset:
process.activate()
def deactivate_process(modeladmin, request, queryset):
for process in queryset:
process.deactivate()
activate_process.short_description = "Activate selected process"
deactivate_process.short_description = "Deactivate selected process"
class ProcessAdmin(admin.ModelAdmin):
list_display = [
"id",
"licensing_authority",
"licensing_authority_document_identifier",
"registration_office",
"registration_office_document_identifier",
"is_active",
"is_deleted",
]
actions = [
activate_process,
deactivate_process,
]
admin.site.register(Process, ProcessAdmin)