Pridani sitemap, fix flake
This commit is contained in:
@@ -8,15 +8,15 @@ class QueryBuilder:
|
||||
self.model = model
|
||||
|
||||
def get_simple_query(
|
||||
self,
|
||||
extra_select: Optional[list] = None,
|
||||
created_by_id: Optional[int] = None,
|
||||
order_by: Optional[list] = None,
|
||||
only_public: Optional[bool] = False,
|
||||
only_my: Optional[bool] = False,
|
||||
# include_others_public: Optional[bool] = False,
|
||||
url_slug: Optional[str] = None,
|
||||
include_deleted: bool = False
|
||||
self,
|
||||
extra_select: Optional[list] = None,
|
||||
created_by_id: Optional[int] = None,
|
||||
order_by: Optional[list] = None,
|
||||
only_public: Optional[bool] = False,
|
||||
only_my: Optional[bool] = False,
|
||||
include_others_public: Optional[bool] = False,
|
||||
url_slug: Optional[str] = None,
|
||||
include_deleted: bool = False
|
||||
):
|
||||
if not extra_select:
|
||||
extra_select = []
|
||||
@@ -37,22 +37,22 @@ class QueryBuilder:
|
||||
if created_by_id and hasattr(self.model, "created_by_id"):
|
||||
my_filters.append(self.model.created_by_id == created_by_id)
|
||||
|
||||
# others_filters = []
|
||||
# if include_others_public:
|
||||
# # TODO: Toto jeste neni implementovane nikde v resolverech!
|
||||
# if hasattr(self.model, "is_public"):
|
||||
# others_filters.append(self.model.is_public.is_(True))
|
||||
#
|
||||
# if hasattr(self.model, "created_by_id"):
|
||||
# others_filters.append(or_(
|
||||
# self.model.created_by_id != created_by_id,
|
||||
# self.model.created_by_id.is_(None)
|
||||
# ))
|
||||
others_filters = []
|
||||
if include_others_public:
|
||||
# TODO: Toto jeste neni implementovane nikde v resolverech!
|
||||
if hasattr(self.model, "is_public"):
|
||||
others_filters.append(self.model.is_public.is_(True))
|
||||
|
||||
if hasattr(self.model, "created_by_id"):
|
||||
others_filters.append(or_(
|
||||
self.model.created_by_id != created_by_id,
|
||||
self.model.created_by_id.is_(None)
|
||||
))
|
||||
|
||||
if my_filters:
|
||||
ownership_filters.append(and_(*my_filters))
|
||||
# if others_filters:
|
||||
# ownership_filters.append(and_(*others_filters))
|
||||
if others_filters:
|
||||
ownership_filters.append(and_(*others_filters))
|
||||
|
||||
query = query.filter(or_(*ownership_filters))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user