Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to un-filter facet not shown for ?col__exact=value #1695

Open
simonw opened this issue Mar 30, 2022 · 2 comments
Open

Option to un-filter facet not shown for ?col__exact=value #1695

simonw opened this issue Mar 30, 2022 · 2 comments

Comments

@simonw
Copy link
Owner

simonw commented Mar 30, 2022

Spotted this on a page with COUNTY__exact=Lee in the URL:

CleanShot 2022-03-29 at 21 41 46@2x

With COUNTY=Lee you get this instead:

image

@simonw
Copy link
Owner Author

simonw commented Mar 30, 2022

Relevant template:

{% if not facet_value.selected %}
<li><a href="{{ facet_value.toggle_url }}">{{ (facet_value.label | string()) or "-" }}</a> {{ "{:,}".format(facet_value.count) }}</li>
{% else %}
<li>{{ facet_value.label or "-" }} &middot; {{ "{:,}".format(facet_value.count) }} <a href="{{ facet_value.toggle_url }}" class="cross">&#x2716;</a></li>
{% endif %}

Populated from here:

column_qs = column
if column.startswith("_"):
column_qs = "{}__exact".format(column)
selected = (column_qs, str(row["value"])) in qs_pairs
if selected:
toggle_path = path_with_removed_args(
self.request, {column_qs: str(row["value"])}
)

@simonw
Copy link
Owner Author

simonw commented Mar 30, 2022

selected = (column_qs, str(row["value"])) in qs_pairs is wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant