Coverage for extras/search.py: 100%

33 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 ConfigContextProfileIndex(SearchIndex): 

8 model = models.ConfigContextProfile 

9 fields = ( 

10 ('name', 100), 

11 ('description', 500), 

12 ('comments', 5000), 

13 ) 

14 display_attrs = ('description',) 

15 

16 

17@register_search 

18class CustomFieldIndex(SearchIndex): 

19 model = models.CustomField 

20 fields = ( 

21 ('name', 100), 

22 ('label', 100), 

23 ('description', 500), 

24 ('comments', 5000), 

25 ) 

26 display_attrs = ('description',) 

27 

28 

29@register_search 

30class ImageAttachmentIndex(SearchIndex): 

31 model = models.ImageAttachment 

32 fields = ( 

33 ('name', 100), 

34 ('filename', 110), 

35 ('description', 500), 

36 ) 

37 display_attrs = ('description',) 

38 

39 

40@register_search 

41class JournalEntryIndex(SearchIndex): 

42 model = models.JournalEntry 

43 fields = ( 

44 ('comments', 5000), 

45 ) 

46 category = 'Journal' 

47 display_attrs = ('kind', 'created_by') 

48 

49 

50@register_search 

51class TagIndex(SearchIndex): 

52 model = models.Tag 

53 fields = ( 

54 ('name', 100), 

55 ('slug', 110), 

56 ('description', 500), 

57 ) 

58 display_attrs = ('description',) 

59 

60 

61@register_search 

62class WebhookEntryIndex(SearchIndex): 

63 model = models.Webhook 

64 fields = ( 

65 ('name', 100), 

66 ('description', 500), 

67 ) 

68 display_attrs = ('description',)