#36751: Django Admin facets broken in 6.0
-------------------------------+------------------------------------
Reporter: Rafael Urben | Owner: (none)
Type: Bug | Status: new
Component: contrib.admin | Version: 6.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Antoliny):
* stage: Unreviewed => Accepted
Comment:
Thank you for the detailed explanation Rafael !!
It seems that the issue occurs when adding date related fields to the
filter.
When comparing 5.2 and 6.0, there is a slight difference in the results of
the `DateFieldListFilter` class’s `get_facet_counts` method.
In 5.2, when `param_dict` is empty, the Count does not have a filter, but
in 6.0, it does.
6.0
{{{Count(F(id), filter=(AND:))}}}
5.2
{{{Count(F(id))}}}
It seems that this `filter` is causing the error.
When I modified the return value of `get_facet_counts` like this, the
problem did not occur:
{{{
return {
f"{i}__c": models.Count(
pk_attname,
**({"filter": models.Q(**param_dict)} if param_dict else {})
)
for i, (_, param_dict) in enumerate(self.links)
}
}}}
However, I’m not sure if this is the actual solution.
Could this be an ORM related issue?
--
Ticket URL: <https://code.djangoproject.com/ticket/36751#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019aaf7ddd0c-70d3300c-8428-4b80-b332-fb85b7e21e93-000000%40eu-central-1.amazonses.com.