tables.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import django_tables2 as tables
  2. from dbsynce.models import *
  3. from dbsynce.models import *
  4. from django.contrib.auth import get_user_model
  5. from django.utils.html import format_html
  6. from django.utils.translation import gettext_lazy as _
  7. from dbsynce.lib.dicts import *
  8. class ProvidersLandingTable(tables.Table):
  9. id = tables.Column(
  10. verbose_name=_('ID'),
  11. attrs={
  12. "td": {"width": "5%"}
  13. }
  14. )
  15. gap = tables.Column(
  16. #verbose_name=_('Status'),
  17. attrs={
  18. 'th': {'scope': 'col'},
  19. "td": {"width": "20%"}
  20. }
  21. )
  22. service_status = tables.Column(
  23. attrs={
  24. 'th': {'scope': 'col'},
  25. "td": {"width": "20%"}
  26. }
  27. )
  28. default_location = tables.Column(
  29. attrs={
  30. 'th': {'scope': 'col'},
  31. "td": {"width": "20%"}
  32. }
  33. )
  34. resource = tables.LinkColumn(
  35. 'sharix_admin:resource_detail',
  36. args=[tables.A('resource.pk')],
  37. accessor='resource.resource_type',
  38. verbose_name=_('Resource'),
  39. attrs={
  40. 'th': {'scope': 'col'},
  41. "td": {"width": "20%"}
  42. }
  43. )
  44. class Meta:
  45. model = Provider
  46. attrs = {
  47. "class": "table table-layout-fixed"
  48. }
  49. exclude = (
  50. 'id_metaservice',
  51. 'requirements',
  52. 'status',
  53. 'location_type',
  54. 'default_location',
  55. 'is_global',
  56. 'is_visible',
  57. 'ticket_status',
  58. )