Archived
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]>
31 lines
1.3 KiB
Python
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
|