tables.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import django_tables2 as tables
  2. from dbsynce.models import *
  3. from webservice_running.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 ResourcesLocalTable(tables.Table):
  9. id = tables.LinkColumn(
  10. 'webservice_running:resource_local_detail',
  11. args=[tables.A('pk')],
  12. verbose_name=_('ID'),
  13. attrs={
  14. "td": {"width": "5%"}
  15. }
  16. )
  17. # В user ссылка LinkColumn на страницу Аси "Информация о партнере" страница partner_information_form
  18. local_data = tables.Column(
  19. verbose_name=_('Локальные данные'),
  20. attrs={
  21. 'th': {'scope': 'col'},
  22. "td": {"width": "20%"}
  23. }
  24. )
  25. resource.resource_type = tables.Column(
  26. verbose_name=_('Тип ресурса'),
  27. attrs={
  28. 'th': {'scope': 'col'},
  29. "td": {"width": "20%"}
  30. }
  31. )
  32. class Meta:
  33. model = ResourceLocal
  34. attrs = {
  35. "class": "table table-layout-fixed"
  36. }
  37. exclude = (
  38. #'car_number',
  39. #'transmission_type',
  40. )