Projet

Général

Profil

0001-dataviz-don-t-display-unconfigured-graphs-35405.patch

Frédéric Péters, 14 août 2019 15:28

Télécharger (1,58 ko)

Voir les différences:

Subject: [PATCH] dataviz: don't display unconfigured graphs (#35405)

 combo/apps/dataviz/models.py                             | 3 +++
 combo/apps/dataviz/templates/combo/chartngcell_form.html | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
combo/apps/dataviz/models.py
135 135
    def get_additional_label(self):
136 136
        return self.title
137 137

  
138
    def is_relevant(self, context=None):
139
        return bool(self.data_reference)
140

  
138 141
    def save(self, *args, **kwargs):
139 142
        if self.data_reference:
140 143
            site_key, visualization_slug = self.data_reference.split(':')
combo/apps/dataviz/templates/combo/chartngcell_form.html
1 1
<div style="position: relative">
2 2
{{ form.as_p }}
3
{% if cell.chart_type != "table" %}
3
{% if cell.chart_type != "table" and cell.is_relevant %}
4 4
<div style="position: absolute; right: 0; top: 0; width: 300px; height: 150px">
5 5
  <embed type="image/svg+xml" src="{% url 'combo-dataviz-graph' cell=cell.id %}?width=300&height=150"/>
6 6
</div>
7
-