diff --git a/django_jalali/admin/filters.py b/django_jalali/admin/filters.py index 50ef281..4893d08 100644 --- a/django_jalali/admin/filters.py +++ b/django_jalali/admin/filters.py @@ -1,4 +1,5 @@ import jdatetime +import django from django.contrib import admin from django.contrib.admin.options import IncorrectLookupParameters from django.core.exceptions import ValidationError @@ -75,8 +76,12 @@ def __init__(self, field, request, params, model, model_admin, field_path): super().__init__(field, request, params, model, model_admin, field_path) def queryset(self, request, queryset): + params = self.used_parameters.copy() + if django.VERSION > (5, 0): + params = {k: v[0] if isinstance(v, list) else v for k, v in params.items()} + try: - return queryset.filter(**self.used_parameters) + return queryset.filter(**params) except ValidationError as e: raise IncorrectLookupParameters(e)