Pridani sitemap, fix flake

This commit is contained in:
Michal Kváček
2024-02-26 09:44:40 +01:00
parent ff32c36a94
commit 1f8b338297
34 changed files with 590 additions and 205 deletions
+22 -22
View File
@@ -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))