Coverage for tenancy/search.py: 100%

27 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 18:35 +0000

1from netbox.search import SearchIndex, register_search 

2 

3from . import models 

4 

5 

6@register_search 

7class ContactIndex(SearchIndex): 

8 model = models.Contact 

9 fields = ( 

10 ('name', 100), 

11 ('title', 300), 

12 ('phone', 300), 

13 ('email', 300), 

14 ('address', 300), 

15 ('link', 300), 

16 ('description', 500), 

17 ('comments', 5000), 

18 ) 

19 display_attrs = ('title', 'phone', 'email', 'description') 

20 

21 

22@register_search 

23class ContactGroupIndex(SearchIndex): 

24 model = models.ContactGroup 

25 fields = ( 

26 ('name', 100), 

27 ('slug', 110), 

28 ('description', 500), 

29 ('comments', 5000), 

30 ) 

31 display_attrs = ('description',) 

32 

33 

34@register_search 

35class ContactRoleIndex(SearchIndex): 

36 model = models.ContactRole 

37 fields = ( 

38 ('name', 100), 

39 ('slug', 110), 

40 ('description', 500), 

41 ('comments', 5000), 

42 ) 

43 display_attrs = ('description',) 

44 

45 

46@register_search 

47class TenantIndex(SearchIndex): 

48 model = models.Tenant 

49 fields = ( 

50 ('name', 100), 

51 ('slug', 110), 

52 ('description', 500), 

53 ('comments', 5000), 

54 ) 

55 display_attrs = ('group', 'description') 

56 

57 

58@register_search 

59class TenantGroupIndex(SearchIndex): 

60 model = models.TenantGroup 

61 fields = ( 

62 ('name', 100), 

63 ('slug', 110), 

64 ('description', 500), 

65 ('comments', 5000), 

66 ) 

67 display_attrs = ('description',)