diff --git a/src/utils_flask_sqla/serializers.py b/src/utils_flask_sqla/serializers.py index 1b9df51..1e48be6 100644 --- a/src/utils_flask_sqla/serializers.py +++ b/src/utils_flask_sqla/serializers.py @@ -136,7 +136,7 @@ def serializefn(self, recursif=False, columns=(), exclude=[], relationships=(), if getattr(self, rel): # we call the child as_dict with a relationships list which exclude the current model # this avoid infinite recursion when two models reference each other - _relationships = list(filter(lambda r: r[0] != rel, selected_relationships)) + _relationships = list(filter(lambda r: r[0] != rel, relationships)) if uselist is True: out[rel] = [ x.as_dict(recursif=recursif, depth=depth, relationships=_relationships)