From 24cc64479116981ac3016922fd4b924f7b58d9cb Mon Sep 17 00:00:00 2001 From: Javier Munoz Date: Mon, 4 Jan 2021 14:31:02 +0100 Subject: [PATCH] fix(models): Check for None entity when getting query models Under some circunstances, such as prepping an aliased subquery to be joined later on, the model entity is missing, provoking an error when trying to apply filters. --- sqlalchemy_filters/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlalchemy_filters/models.py b/sqlalchemy_filters/models.py index 1c79516..2f33387 100644 --- a/sqlalchemy_filters/models.py +++ b/sqlalchemy_filters/models.py @@ -76,7 +76,7 @@ def get_query_models(query): if model_class not in models: models.append(model_class) - return {model.__name__: model for model in models} + return {model.__name__: model for model in models if model is not None} def get_model_from_spec(spec, query, default_model=None):