From 76a11cb60a25e523575577cbc12a0aa61f24272e Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Mon, 6 Sep 2021 01:59:47 -0300 Subject: [PATCH] =?UTF-8?q?remove=20many=5Fto=5Fmany=20da=20constru=C3=A7?= =?UTF-8?q?=C3=A3o=20de=20filter=20lookups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/api/core/filters.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sapl/api/core/filters.py b/sapl/api/core/filters.py index cc4a601c1..312f32131 100644 --- a/sapl/api/core/filters.py +++ b/sapl/api/core/filters.py @@ -11,6 +11,7 @@ from django_filters.filters import CharFilter from django_filters.filterset import BaseFilterSet, FilterSetMetaclass, \ FilterSet from django_filters.utils import resolve_field, get_all_model_fields +from sapl.materia.models import MateriaLegislativa class SaplFilterSetMixin(FilterSet): @@ -53,13 +54,18 @@ class SaplFilterSetMixin(FilterSet): for f_str in fields_model: if f_str not in fields: f = model._meta.get_field(f_str) + if f.many_to_many: + continue + fields[f_str] = [] def get_keys_lookups(cl, sub_f): r = [] for lk, lv in cl.items(): + if lk == 'contained_by': continue + sflk = f'{sub_f}{"__" if sub_f else ""}{lk}' r.append(sflk)