Fixed a facet filter bug where redundant code would error out depending on the query.
All checks were successful
StarFields Django Rest Framework Generics / build (push) Successful in 12s

This commit is contained in:
2024-10-08 11:03:20 +03:00
parent 28ac95fd47
commit 353106ee17
2 changed files with 3 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project] [project]
name = "starfields-drf-generics" name = "starfields-drf-generics"
version = "0.3.0" version = "0.3.1"
authors = [ authors = [
{ name="Anastasios Svolis", email="support@starfields.gr" }, { name="Anastasios Svolis", email="support@starfields.gr" },
] ]
@@ -18,7 +18,7 @@ classifiers = [
] ]
[project.urls] [project.urls]
"Homepage" = "https://git.vickys-corner.xyz/ace/starfields-drf-generics" "Homepage" = "https://git.starfieldsweb.com/StarFields/starfields-drf-generics"
[tool.setuptools.packages.find] [tool.setuptools.packages.find]
where = ["starfields_drf_generics"] where = ["starfields_drf_generics"]

View File

@@ -334,8 +334,7 @@ class FacetFilter(BaseFilterBackend):
if view.facets: if view.facets:
for facet in view.facets: for facet in view.facets:
request_slug = request.query_params[facet.slug] if facet.slug in request.query_params.keys():
if facet.slug in request.query_params.keys() and request_slug:
tag_filterlist = request.query_params.get(facet.slug) tag_filterlist = request.query_params.get(facet.slug)
if tag_filterlist == '': if tag_filterlist == '':
# If the tag filterlist is empty then we're not # If the tag filterlist is empty then we're not