konova/intervention/admin.py
mpeltriaux d3d4fac7d3 #146 Admins and update_all_parcels.py
* extends admin backend
    * adds found_in_codelists to KonovaCodeAdmin to see where a KonovaCode can be found in
    * improves rendering of after_states and before_states for all AbstractCompensationAdmins
    * adds geometry_id to all major datatype admin backends
    * adds st_area like calculation to geometry admin backend
* update_all_parcels
    * orders geometries by size (small to big) to process smaller geometries first and bigger later
    * adds more output to command for a better overview of what is just going on
2022-04-13 11:42:04 +02:00

79 lines
1.8 KiB
Python

from django.contrib import admin
from intervention.models import Intervention, Responsibility, Legal, Revocation, InterventionDocument
from konova.admin import AbstractDocumentAdmin, BaseObjectAdmin
class InterventionAdmin(BaseObjectAdmin):
list_display = [
"id",
"identifier",
"title",
"created",
"deleted",
]
filter_horizontal = [
"users"
]
def get_fields(self, request, obj=None):
return super().get_fields(request, obj) + [
"identifier",
"title",
"comment",
"checked",
"recorded",
"users",
"geometry",
]
def get_readonly_fields(self, request, obj=None):
return super().get_readonly_fields(request, obj) + [
"checked",
"recorded",
"geometry",
]
class InterventionDocumentAdmin(AbstractDocumentAdmin):
pass
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",
]
class RevocationAdmin(admin.ModelAdmin):
list_display = [
"id",
"date",
"comment",
"created",
]
admin.site.register(Intervention, InterventionAdmin)
# 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)