dataviz: don't display unconfigured graphs (#35405)

This commit is contained in:
Frédéric Péters 2019-08-14 15:25:07 +02:00
parent 073520e111
commit 73a7643788
2 changed files with 4 additions and 1 deletions

View File

@ -135,6 +135,9 @@ class ChartNgCell(CellBase):
def get_additional_label(self):
return self.title
def is_relevant(self, context=None):
return bool(self.data_reference)
def save(self, *args, **kwargs):
if self.data_reference:
site_key, visualization_slug = self.data_reference.split(':')

View File

@ -1,6 +1,6 @@
<div style="position: relative">
{{ form.as_p }}
{% if cell.chart_type != "table" %}
{% if cell.chart_type != "table" and cell.is_relevant %}
<div style="position: absolute; right: 0; top: 0; width: 300px; height: 150px">
<embed type="image/svg+xml" src="{% url 'combo-dataviz-graph' cell=cell.id %}?width=300&height=150"/>
</div>