@@ -176,7 +176,7 @@ async def handle_row_action(
176
176
except SQLAlchemyError as exc :
177
177
raise ActionFailed (str (exc )) from exc
178
178
179
- def get_list_query (self ) -> Select :
179
+ def get_list_query (self , request : Request ) -> Select :
180
180
"""
181
181
Return a Select expression which is used as base statement for
182
182
[find_all][starlette_admin.views.BaseModelView.find_all] method.
@@ -185,10 +185,10 @@ def get_list_query(self) -> Select:
185
185
```python hl_lines="3-4"
186
186
class PostView(ModelView):
187
187
188
- def get_list_query(self):
188
+ def get_list_query(self, request: Request ):
189
189
return super().get_list_query().where(Post.published == true())
190
190
191
- def get_count_query(self):
191
+ def get_count_query(self, request: Request ):
192
192
return super().get_count_query().where(Post.published == true())
193
193
```
194
194
@@ -198,7 +198,7 @@ def get_count_query(self):
198
198
"""
199
199
return select (self .model )
200
200
201
- def get_count_query (self ) -> Select :
201
+ def get_count_query (self , request : Request ) -> Select :
202
202
"""
203
203
Return a Select expression which is used as base statement for
204
204
[count][starlette_admin.views.BaseModelView.count] method.
@@ -207,10 +207,10 @@ def get_count_query(self) -> Select:
207
207
```python hl_lines="6-7"
208
208
class PostView(ModelView):
209
209
210
- def get_list_query(self):
210
+ def get_list_query(self, request: Request ):
211
211
return super().get_list_query().where(Post.published == true())
212
212
213
- def get_count_query(self):
213
+ def get_count_query(self, request: Request ):
214
214
return super().get_count_query().where(Post.published == true())
215
215
```
216
216
"""
@@ -252,7 +252,7 @@ async def count(
252
252
where : Union [Dict [str , Any ], str , None ] = None ,
253
253
) -> int :
254
254
session : Union [Session , AsyncSession ] = request .state .session
255
- stmt = self .get_count_query ()
255
+ stmt = self .get_count_query (request )
256
256
if where is not None :
257
257
if isinstance (where , dict ):
258
258
where = build_query (where , self .model )
@@ -274,7 +274,7 @@ async def find_all(
274
274
order_by : Optional [List [str ]] = None ,
275
275
) -> Sequence [Any ]:
276
276
session : Union [Session , AsyncSession ] = request .state .session
277
- stmt = self .get_list_query ().offset (skip )
277
+ stmt = self .get_list_query (request ).offset (skip )
278
278
if limit > 0 :
279
279
stmt = stmt .limit (limit )
280
280
if where is not None :
0 commit comments