from django import forms from .models import RouterMonSettings class RouterMonSettingsForm(forms.ModelForm): class Meta: model = RouterMonSettings fields = ['enabled', 'syslog_port', 'excluded_clients', 'retention_days'] widgets = { 'excluded_clients': forms.Textarea(attrs={'rows': 4, 'class': 'font-mono text-sm'}), } help_texts = { 'syslog_port': ( 'UDP port the server listens on (default 5514). ' 'Configure your router to send syslog here. ' 'If your router only supports port 514, add an iptables redirect on the k3s node.' ), 'excluded_clients': 'One LAN IP per line. Queries from these devices will be ignored.', 'retention_days': 'DNS query log records older than this will be automatically deleted.', }