search.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. from netbox.search import SearchIndex, register_search
  2. from . import models
  3. @register_search
  4. class ContactIndex(SearchIndex):
  5. model = models.Contact
  6. fields = (
  7. ('name', 100),
  8. ('title', 300),
  9. ('phone', 300),
  10. ('email', 300),
  11. ('address', 300),
  12. ('link', 300),
  13. ('description', 500),
  14. ('comments', 5000),
  15. )
  16. @register_search
  17. class ContactGroupIndex(SearchIndex):
  18. model = models.ContactGroup
  19. fields = (
  20. ('name', 100),
  21. ('slug', 110),
  22. ('description', 500),
  23. )
  24. @register_search
  25. class ContactRoleIndex(SearchIndex):
  26. model = models.ContactRole
  27. fields = (
  28. ('name', 100),
  29. ('slug', 110),
  30. ('description', 500),
  31. )
  32. @register_search
  33. class TenantIndex(SearchIndex):
  34. model = models.Tenant
  35. fields = (
  36. ('name', 100),
  37. ('slug', 110),
  38. ('description', 500),
  39. ('comments', 5000),
  40. )
  41. @register_search
  42. class TenantGroupIndex(SearchIndex):
  43. model = models.TenantGroup
  44. fields = (
  45. ('name', 100),
  46. ('slug', 110),
  47. ('description', 500),
  48. )