mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-07-24 06:24:07 -04:00
26 lines
720 B
Python
26 lines
720 B
Python
from django.contrib import admin
|
|
|
|
from wol.models import Device, Port, Settings
|
|
|
|
|
|
class DeviceAdmin(admin.ModelAdmin):
|
|
list_display = ["name", "ip", "mac", "netmask", "ports"]
|
|
search_fields = ["name", "ip", "mac"]
|
|
list_filter = ["name", "netmask"]
|
|
|
|
def ports(self, obj):
|
|
return ", ".join([p.name for p in obj.port.all()])
|
|
|
|
class PortAdmin(admin.ModelAdmin):
|
|
list_display = ["number", "name"]
|
|
search_fields = ["number", "name"]
|
|
list_filter = ["number", "name"]
|
|
|
|
class SettingsAdmin(admin.ModelAdmin):
|
|
list_display = ["sort_by", "scan_address", "interval"]
|
|
|
|
|
|
admin.site.register(Device, DeviceAdmin)
|
|
admin.site.register(Port, PortAdmin)
|
|
admin.site.register(Settings, SettingsAdmin)
|