Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
views: Tweak ORM queries for speed.
Also remove unused queries.
  • Loading branch information
MostAwesomeDude committed Jul 7, 2011
1 parent 35271b8 commit 40bf48b
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions newrem/views.py
Expand Up @@ -250,18 +250,12 @@ def comics_root():
@app.route("/comics/<int:cid>")
def comics(cid):
try:
comic = Comic.query.filter(Comic.id == cid).one()
comic = Comic.query.filter_by(id=cid).one()
except NoResultFound:
abort(404)

comics = get_neighbors_for(comic)

q = Comic.query.filter(Comic.time < comic.time)
before = q.order_by(Comic.time.desc()).first()

q = Comic.query.filter(Comic.time > comic.time)
after = q.order_by(Comic.time).first()

q = Comic.query.filter(Comic.position < comic.position)
previous = q.order_by(Comic.position.desc()).first()

Expand All @@ -283,8 +277,6 @@ def comics(cid):
kwargs = {
"comic": comic,
"comics": comics,
"before": before,
"after": after,
"chrono": chrono,
"characters": cdict,
}
Expand Down

0 comments on commit 40bf48b

Please sign in to comment.