This commit is contained in:
parent
7eed615991
commit
bf3fd4b39a
|
@ -44,13 +44,14 @@ def query_shouts(slug=None, shout_id=None):
|
||||||
"id", Author.id,
|
"id", Author.id,
|
||||||
"name", Author.name,
|
"name", Author.name,
|
||||||
"slug", Author.slug,
|
"slug", Author.slug,
|
||||||
"pic", Author.pic,
|
"pic", Author.pic
|
||||||
"caption", ShoutAuthor.caption,
|
|
||||||
)
|
)
|
||||||
).label("authors"),
|
).label("authors")
|
||||||
)
|
)
|
||||||
|
.select_from(ShoutAuthor)
|
||||||
.join(Author, ShoutAuthor.author == Author.id)
|
.join(Author, ShoutAuthor.author == Author.id)
|
||||||
.group_by(ShoutAuthor.shout)
|
.where(ShoutAuthor.shout == Shout.id)
|
||||||
|
.correlate(Shout)
|
||||||
.scalar_subquery()
|
.scalar_subquery()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -164,8 +165,7 @@ def get_shouts_with_stats(q, limit=20, offset=0, author_id=None):
|
||||||
"id", Author.id,
|
"id", Author.id,
|
||||||
"name", Author.name,
|
"name", Author.name,
|
||||||
"slug", Author.slug,
|
"slug", Author.slug,
|
||||||
"pic", Author.pic,
|
"pic", Author.pic
|
||||||
"caption", ShoutAuthor.caption,
|
|
||||||
)
|
)
|
||||||
).label("authors")
|
).label("authors")
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user