from django.contrib import admin
from .models import Sistema, sistemas_por_cliente, Device,DeviceHistory, BitacoraErrores

class BitacoraErroresAdmin(admin.ModelAdmin):
    list_display = ['level', 'message','timestamp']

class Sistema_Admin(admin.ModelAdmin):
    def NSistema(self,obj):
        return obj.nombre_sistema
    list_display = ['NSistema']

class SPC(admin.ModelAdmin):
    '''Sistemas Por Cliente'''
    def Cliente(self,obj):
        return obj
    list_display = ['id_sistema','Cliente','num_licencias']

class DeviceHistoryAdmin(admin.ModelAdmin):
    list_display = ['device','first_authentication', 'last_authentication']

class DeviceAdmin(admin.ModelAdmin):
    list_display = ['client', 'device_name', 'ip_address', 'sistema', 'macAddress','database']

admin.site.register(BitacoraErrores,BitacoraErroresAdmin)
admin.site.register(Sistema,Sistema_Admin)
admin.site.register(sistemas_por_cliente,SPC)
admin.site.register(Device,DeviceAdmin)
admin.site.register(DeviceHistory,DeviceHistoryAdmin)