This repository has been archived on 2026-11-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Netbox-Better-IPs/netbox_better_ips/forms.py
T
MrBlakeandClaude Opus 5.5 e9d9b59d16 feat: translate UI to English with German locale
Use English source strings wrapped for gettext, ship a German catalogue, and check that README and package metadata match the PluginConfig.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 21:24:20 +01:00

31 lines
1.3 KiB
Python

from django import forms
from django.utils.translation import gettext_lazy as _
from dcim.models import Location, Region, Site, SiteGroup
from tenancy.models import Tenant, TenantGroup
class NetworkOverviewFilterForm(forms.Form):
q = forms.CharField(required=False, label=_("Search"))
organization = forms.ModelChoiceField(
queryset=Region.objects.all(), required=False, label=_("Organisation / Region")
)
site_group = forms.ModelChoiceField(
queryset=SiteGroup.objects.all(), required=False, label=_("Site group")
)
site = forms.ModelChoiceField(queryset=Site.objects.all(), required=False, label=_("Site"))
location = forms.ModelChoiceField(
queryset=Location.objects.all(), required=False, label=_("Location")
)
tenant_group = forms.ModelChoiceField(
queryset=TenantGroup.objects.all(), required=False, label=_("Tenant group")
)
tenant = forms.ModelChoiceField(
queryset=Tenant.objects.all(), required=False, label=_("Tenant")
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field in self.fields.values():
css_class = "form-select" if isinstance(field.widget, forms.Select) else "form-control"
field.widget.attrs["class"] = css_class