Skip to content

Commit

Permalink
Merge pull request #1137 from devinit/patch/pivot-table
Browse files Browse the repository at this point in the history
Fix pivot table gets_row_highlights tag
  • Loading branch information
edwinmp authored Apr 26, 2022
2 parents cb602b3 + 18e2740 commit 5933089
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h3 class="type-l type-l--trailer">{{ item.title }}</h3>
</div>
{% endif %}
{% endif %}
{% gets_row_highlights as row_highlights %}
{% gets_row_highlights pivot_page=item as row_highlights %}
<div class="chart-container chart-container--full">
<div class="charts__chart" data-title="{{item.title}}">
<div
Expand Down
6 changes: 2 additions & 4 deletions di_website/visualisation/templatetags/chart_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@ def load_viz_assets(context, source='header'):
return load_as_template(context, '\n'.join(assets))

@register.simple_tag(takes_context=True)
def gets_row_highlights(context):
context = Context(context)
self = context['page']
def gets_row_highlights(context, pivot_page):
highlights = []
for highlight in self.row_highlights.all():
for highlight in pivot_page.row_highlights.all():
highlights.append({
"field": highlight.row_highlight_field,
"condition": highlight.row_highlight_condition,
Expand Down

0 comments on commit 5933089

Please sign in to comment.