Fix random handlers

This commit is contained in:
2023-05-06 18:47:26 +02:00
parent 1f4422a9cd
commit 183351ed68
5 changed files with 15 additions and 2 deletions

View File

@@ -43,6 +43,9 @@ async def get_random_author(
{"allowed_langs": allowed_langs}, request.app.state.redis
)
if author_id is None:
raise HTTPException(status.HTTP_204_NO_CONTENT)
return (
await AuthorDB.objects.select_related(SELECT_RELATED_FIELDS)
.prefetch_related(PREFETCH_RELATED_FIELDS)