Fix erreur 500 (catégories cassées)
This commit is contained in:
parent
bdcb27d473
commit
c1cc98ec92
@ -130,13 +130,18 @@ class EventFilter(django_filters.FilterSet):
|
|||||||
if len(params['category']) == 0:
|
if len(params['category']) == 0:
|
||||||
return url
|
return url
|
||||||
else:
|
else:
|
||||||
category = Category.objects.filter(pk=params['category'][0]).first()
|
cat_id = params['category'][0]
|
||||||
del params["category"]
|
del params["category"]
|
||||||
url = parsed_url._replace(query=urlencode(params, doseq=True)).geturl()
|
url = parsed_url._replace(query=urlencode(params, doseq=True)).geturl()
|
||||||
|
if cat_id.isdigit():
|
||||||
|
category = Category.objects.filter(pk=cat_id).first()
|
||||||
if category is None:
|
if category is None:
|
||||||
return url
|
return url
|
||||||
else:
|
else:
|
||||||
return "/cat:" + category.slug + url
|
return "/cat:" + category.slug + url
|
||||||
|
else:
|
||||||
|
return url
|
||||||
|
|
||||||
|
|
||||||
def filter_recurrences(self, queryset, name, value):
|
def filter_recurrences(self, queryset, name, value):
|
||||||
# construct the full lookup expression
|
# construct the full lookup expression
|
||||||
|
Loading…
x
Reference in New Issue
Block a user