1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #35198 -- Fixed facet filters crash on querysets with no primary key.

Thanks Simon Alef for the report.

Regression in 868e2fcdda.
This commit is contained in:
Shafiya Adzhani
2024-02-19 23:12:21 +07:00
committed by Mariusz Felisiak
parent 3cb1ba50cc
commit a738281265
3 changed files with 48 additions and 10 deletions

View File

@@ -140,7 +140,7 @@ class SimpleListFilter(FacetsMixin, ListFilter):
if lookup_qs is not None:
counts[f"{i}__c"] = models.Count(
pk_attname,
filter=lookup_qs.query.where,
filter=models.Q(pk__in=lookup_qs),
)
self.used_parameters[self.parameter_name] = original_value
return counts