# pylint: disable=unused-argument
from django.contrib import admin

from .models import CronLock, Maintenance


class CronLockAdmin(admin.ModelAdmin):
    readonly_fields = ("jobname", "started", "pid")

    def has_change_permission(self, request, obj=None):
        return False

    def has_add_permission(self, request, obj=None):
        return False


class MaintenanceAdmin(admin.ModelAdmin):
    readonly_fields = ("key", "result")

    def has_change_permission(self, request, obj=None):
        return False

    def has_add_permission(self, request, obj=None):
        return False


admin.site.register(CronLock, CronLockAdmin)
admin.site.register(Maintenance, MaintenanceAdmin)
