2021-07-01 13:36:07 +02:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2021-11-15 17:09:17 +01:00
|
|
|
from intervention.models import Intervention, Responsibility, Legal, Revocation, InterventionDocument
|
2021-12-15 13:59:52 +01:00
|
|
|
from konova.admin import AbstractDocumentAdmin, BaseObjectAdmin
|
2021-07-01 13:36:07 +02:00
|
|
|
|
|
|
|
|
2021-12-15 13:59:52 +01:00
|
|
|
class InterventionAdmin(BaseObjectAdmin):
|
2021-07-01 13:36:07 +02:00
|
|
|
list_display = [
|
|
|
|
"id",
|
2021-08-04 15:19:06 +02:00
|
|
|
"identifier",
|
2021-07-01 13:36:07 +02:00
|
|
|
"title",
|
2021-08-02 11:52:20 +02:00
|
|
|
"created",
|
|
|
|
"deleted",
|
2021-07-01 13:36:07 +02:00
|
|
|
]
|
|
|
|
|
2022-02-01 18:41:02 +01:00
|
|
|
filter_horizontal = [
|
|
|
|
"users"
|
|
|
|
]
|
|
|
|
|
|
|
|
def get_fields(self, request, obj=None):
|
|
|
|
return super().get_fields(request, obj) + [
|
|
|
|
"identifier",
|
|
|
|
"title",
|
|
|
|
"comment",
|
|
|
|
"checked",
|
|
|
|
"recorded",
|
|
|
|
"users",
|
2022-04-13 11:42:04 +02:00
|
|
|
"geometry",
|
2022-02-01 18:41:02 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
def get_readonly_fields(self, request, obj=None):
|
|
|
|
return super().get_readonly_fields(request, obj) + [
|
|
|
|
"checked",
|
|
|
|
"recorded",
|
2022-04-13 11:42:04 +02:00
|
|
|
"geometry",
|
2022-02-01 18:41:02 +01:00
|
|
|
]
|
|
|
|
|
2021-12-15 13:59:52 +01:00
|
|
|
|
2021-09-01 16:24:49 +02:00
|
|
|
class InterventionDocumentAdmin(AbstractDocumentAdmin):
|
|
|
|
pass
|
2021-07-01 13:36:07 +02:00
|
|
|
|
2021-12-15 13:59:52 +01:00
|
|
|
|
2021-07-30 09:30:33 +02:00
|
|
|
class ResponsibilityAdmin(admin.ModelAdmin):
|
|
|
|
list_display = [
|
|
|
|
"id",
|
|
|
|
"registration_office",
|
|
|
|
"registration_file_number",
|
|
|
|
"conservation_office",
|
|
|
|
"conservation_file_number",
|
|
|
|
"handler",
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
class LegalAdmin(admin.ModelAdmin):
|
|
|
|
list_display = [
|
|
|
|
"id",
|
|
|
|
"process_type",
|
|
|
|
"registration_date",
|
|
|
|
"binding_date",
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2021-08-04 13:32:35 +02:00
|
|
|
class RevocationAdmin(admin.ModelAdmin):
|
|
|
|
list_display = [
|
|
|
|
"id",
|
|
|
|
"date",
|
|
|
|
"comment",
|
|
|
|
"created",
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2021-07-01 13:36:07 +02:00
|
|
|
admin.site.register(Intervention, InterventionAdmin)
|
2022-02-01 18:41:02 +01:00
|
|
|
|
|
|
|
# Outcommented for a cleaner admin backend on production
|
|
|
|
#admin.site.register(Responsibility, ResponsibilityAdmin)
|
|
|
|
#admin.site.register(Legal, LegalAdmin)
|
|
|
|
#admin.site.register(Revocation, RevocationAdmin)
|
|
|
|
#admin.site.register(InterventionDocument, InterventionDocumentAdmin)
|