mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fix issues with ordering and add field_groups
This commit is contained in:
@ -58,6 +58,9 @@ class ProviderTable(BaseTable):
|
||||
verbose_name='Circuits'
|
||||
)
|
||||
comments = MarkdownColumn()
|
||||
contacts = tables.ManyToManyColumn(
|
||||
linkify_item=True
|
||||
)
|
||||
tags = TagColumn(
|
||||
url_name='circuits:provider_list'
|
||||
)
|
||||
@ -66,7 +69,7 @@ class ProviderTable(BaseTable):
|
||||
model = Provider
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'asn', 'account', 'portal_url', 'noc_contact', 'admin_contact', 'circuit_count',
|
||||
'comments', 'tags', 'created', 'last_updated',
|
||||
'comments', 'contacts', 'tags', 'created', 'last_updated',
|
||||
)
|
||||
default_columns = ('pk', 'name', 'asn', 'account', 'circuit_count')
|
||||
|
||||
@ -142,6 +145,9 @@ class CircuitTable(BaseTable):
|
||||
)
|
||||
commit_rate = CommitRateColumn()
|
||||
comments = MarkdownColumn()
|
||||
contacts = tables.ManyToManyColumn(
|
||||
linkify_item=True
|
||||
)
|
||||
tags = TagColumn(
|
||||
url_name='circuits:circuit_list'
|
||||
)
|
||||
@ -150,7 +156,7 @@ class CircuitTable(BaseTable):
|
||||
model = Circuit
|
||||
fields = (
|
||||
'pk', 'id', 'cid', 'provider', 'type', 'status', 'tenant', 'termination_a', 'termination_z', 'install_date',
|
||||
'commit_rate', 'description', 'comments', 'tags', 'created', 'last_updated',
|
||||
'commit_rate', 'description', 'comments', 'contacts', 'tags', 'created', 'last_updated',
|
||||
)
|
||||
default_columns = (
|
||||
'pk', 'cid', 'provider', 'type', 'status', 'tenant', 'termination_a', 'termination_z', 'description',
|
||||
|
@ -101,6 +101,11 @@ class DeviceComponentFilterForm(CustomFieldModelFilterForm):
|
||||
|
||||
class RegionFilterForm(ContactModelFilterForm, CustomFieldModelFilterForm):
|
||||
model = Region
|
||||
field_groups = [
|
||||
['q', 'tag'],
|
||||
['parent_id'],
|
||||
['contact', 'contact_role'],
|
||||
]
|
||||
parent_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
required=False,
|
||||
@ -111,6 +116,11 @@ class RegionFilterForm(ContactModelFilterForm, CustomFieldModelFilterForm):
|
||||
|
||||
class SiteGroupFilterForm(ContactModelFilterForm, CustomFieldModelFilterForm):
|
||||
model = SiteGroup
|
||||
field_groups = [
|
||||
['q', 'tag'],
|
||||
['parent_id'],
|
||||
['contact', 'contact_role'],
|
||||
]
|
||||
parent_id = DynamicModelMultipleChoiceField(
|
||||
queryset=SiteGroup.objects.all(),
|
||||
required=False,
|
||||
@ -309,6 +319,10 @@ class RackReservationFilterForm(TenancyFilterForm, CustomFieldModelFilterForm):
|
||||
|
||||
class ManufacturerFilterForm(ContactModelFilterForm, CustomFieldModelFilterForm):
|
||||
model = Manufacturer
|
||||
field_groups = [
|
||||
['q', 'tag'],
|
||||
['contact', 'contact_role'],
|
||||
]
|
||||
tag = TagFilterField(model)
|
||||
|
||||
|
||||
|
@ -11,11 +11,11 @@ __all__ = (
|
||||
'ContactAssignmentFilterSet',
|
||||
'ContactFilterSet',
|
||||
'ContactGroupFilterSet',
|
||||
'ContactModelFilterSet',
|
||||
'ContactRoleFilterSet',
|
||||
'TenancyFilterSet',
|
||||
'TenantFilterSet',
|
||||
'TenantGroupFilterSet',
|
||||
'ContactModelFilterSet'
|
||||
)
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ class TenantFilterSet(PrimaryModelFilterSet, ContactModelFilterSet):
|
||||
|
||||
class Meta:
|
||||
model = Tenant
|
||||
fields = ['id', 'name', 'slug']
|
||||
fields = ['id', 'name', 'slug', 'description']
|
||||
|
||||
def search(self, queryset, name, value):
|
||||
if not value.strip():
|
||||
|
@ -5,9 +5,9 @@ from tenancy.models import *
|
||||
from utilities.forms import DynamicModelChoiceField, DynamicModelMultipleChoiceField
|
||||
|
||||
__all__ = (
|
||||
'ContactModelFilterForm',
|
||||
'TenancyForm',
|
||||
'TenancyFilterForm',
|
||||
'ContactModelFilterForm'
|
||||
)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user