You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
konova/intervention/admin.py

81 lines
1.8 KiB
Python

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