Projet

Général

Profil

0001-visualization-add-a-duplicate-button-39637.patch

Benjamin Dauvergne, 12 février 2020 19:08

Télécharger (2,54 ko)

Voir les différences:

Subject: [PATCH] visualization: add a duplicate button (#39637)

 bijoe/templates/bijoe/visualization.html |  2 ++
 bijoe/visualization/utils.py             | 18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
bijoe/templates/bijoe/visualization.html
15 15
{% block actions %}
16 16
  <a rel="popup" class="button" href="{% url "rename-visualization" pk=object.pk %}">{% trans "Rename" %}</a>
17 17
  <a rel="popup" class="button" href="{% url "delete-visualization" pk=object.pk %}">{% trans "Delete" %}</a>
18
  <a rel="popup" href="{% url "create-visualization" warehouse=warehouse.name cube=cube.name %}?{{ visualization.query_dict.urlencode }}"
19
         title="{{ visualization.title }}" class="button">{% trans "Duplicate" %}</a>
18 20
  <a class="button" href="{% url "visualization-ods" pk=object.pk %}">{% trans "Export as ODS" %}</a>
19 21
  <a download class="button" href="{% url "export-visualization" pk=object.pk %}">{% trans "Export as JSON" %}</a>
20 22
  <a href="{{ iframe_url }}" class="button">{% trans "URL for IFRAME" %}</a>
bijoe/visualization/utils.py
28 28
from django.utils.safestring import mark_safe
29 29
from django.utils.translation import ugettext_lazy as _
30 30
from django.utils import six
31
from django.http import Http404
31
from django.http import Http404, QueryDict
32 32
from django.conf import settings
33 33

  
34 34
from ..utils import get_warehouses
......
364 364
        else:
365 365
            self.table_title = self.title()
366 366
            yield self
367

  
368
    @property
369
    def query_dict(self):
370
        q = QueryDict(mutable=True)
371
        for key in self.filters:
372
            q.setlist('filter__' + key, self.filters[key])
373
        if self.drilldown_x:
374
            q['drilldown_x'] = self.drilldown_x.name
375
        if self.drilldown_y:
376
            q['drilldown_y'] = self.drilldown_y.name
377
        if self.loop:
378
            q['loop'] = self.loop.name
379
        q['measure'] = self.measure.name
380
        q['representation'] = self.representation
381
        q._mutable = False
382
        return q
367
-