Développement #68095 » dataviz_fix_auto_transpose.py
1 |
from django.conf import settings |
---|---|
2 |
from combo.apps.dataviz.models import ChartNgCell |
3 |
|
4 |
base_url = settings.SITE_BASE_URL |
5 |
qs = ChartNgCell.objects.filter( |
6 |
validity_info__invalid_since__isnull=True, statistic__isnull=False, chart_type='table' |
7 |
)
|
8 |
for cell in qs: |
9 |
try: |
10 |
chart = cell.get_chart() |
11 |
except: |
12 |
continue
|
13 |
transpose = bool(chart.axis_count == 2) |
14 |
if transpose: |
15 |
print('Switch to "table inverted" on cell %s from page %s' % (cell.pk, settings.SITE_BASE_URL + cell.page.get_online_url())) |
16 |
cell.chart_type = 'table-inverted' |
17 |
cell.save() |