Skip to content

Commit 3cd803f

Browse files
authored
Closes: #110 - Add License (and other) models to global search (#118)
2 parents 27dd090 + 6484e05 commit 3cd803f

1 file changed

Lines changed: 63 additions & 1 deletion

File tree

netbox_lifecycle/search.py

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,73 @@
11
from netbox.search import SearchIndex, register_search
2-
from netbox_lifecycle.models import SupportContract
2+
from netbox_lifecycle.models import *
3+
4+
5+
@register_search
6+
class VendorIndex(SearchIndex):
7+
model = Vendor
8+
fields = (
9+
('name', 100),
10+
('description', 4000),
11+
('comments', 5000),
12+
)
13+
display_attrs = ('description',)
14+
15+
16+
@register_search
17+
class SupportSKUIndex(SearchIndex):
18+
model = SupportSKU
19+
fields = (
20+
('sku', 100),
21+
('description', 4000),
22+
('comments', 5000),
23+
)
24+
display_attrs = ('manufacturer', 'description')
325

426

527
@register_search
628
class SupportContractIndex(SearchIndex):
729
model = SupportContract
830
fields = (
931
('contract_id', 100),
32+
('description', 4000),
33+
('comments', 5000),
34+
)
35+
display_attrs = ('vendor', 'start', 'renewal', 'end', 'description')
36+
37+
38+
@register_search
39+
class SupportContractAssignmentIndex(SearchIndex):
40+
model = SupportContractAssignment
41+
fields = (
42+
('contract', 100),
43+
('sku', 300),
44+
('device', 400),
45+
('license', 500),
46+
('description', 4000),
47+
('comments', 5000),
48+
)
49+
display_attrs = ('vendor', 'start', 'renewal', 'end', 'description')
50+
51+
52+
@register_search
53+
class LicenseIndex(SearchIndex):
54+
model = License
55+
fields = (
56+
('name', 100),
57+
('description', 4000),
58+
('comments', 5000),
59+
)
60+
display_attrs = ('manufacturer', 'description')
61+
62+
63+
@register_search
64+
class LicenseAssignmentIndex(SearchIndex):
65+
model = LicenseAssignment
66+
fields = (
67+
('license', 100),
68+
('vendor', 200),
69+
('device', 300),
70+
('description', 4000),
1071
('comments', 5000),
1172
)
73+
display_attrs = ('manufacturer', 'description')

0 commit comments

Comments
 (0)