Skip to content

Commit

Permalink
Pass sid values not objects for measure selections display list
Browse files Browse the repository at this point in the history
  • Loading branch information
dalecannon committed Mar 22, 2024
1 parent 8d9ca9e commit 33c0220
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions measures/jinja2/includes/measures/list.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@
<div class="govuk-details__text">
{% if measure_selections %}
{% set table_rows = [] %}
{% for measure in measure_selections %}
{% for sid in measure_selections %}
{% set measure_link %}
<a class="govuk-link govuk-!-font-weight-bold" href="{{measure.get_url()}}">{{measure.sid}}</a>
<a class="govuk-link govuk-!-font-weight-bold" href="{{ url('measure-ui-detail', args=[sid]) }}">{{sid}}</a>
{% endset %}
{{ table_rows.append([
{"html": measure_link},
Expand Down
9 changes: 3 additions & 6 deletions measures/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,10 @@ def get_context_data(self, **kwargs):
if context["has_next_page"]:
context["next_page_number"] = page.next_page_number()

measure_selections = [
SelectableObjectsForm.object_id_from_field_name(name)
for name in self.measure_selections
]
context["measure_selections"] = models.Measure.objects.filter(
pk__in=measure_selections,
)
pk__in=self.measure_selections,
).values_list("sid", flat=True)

context["query_params"] = True
context[
"base_url"
Expand Down

0 comments on commit 33c0220

Please sign in to comment.