diff options
| author | Alexis Metaireau <alexis@notmyidea.org> | 2017-01-16 21:15:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-16 21:15:43 +0100 |
| commit | 8615fde00ad4c402a8cad3bd23c7a0e4e3788d32 (patch) | |
| tree | 7b2f7a58a5ae744555de148d362da241533d338b /budget/web.py | |
| parent | dc75a72dd0caeafce20b09d3ad538bdcbabf4408 (diff) | |
| parent | 8e5ac8ae98824b8b359cc0f020b10acb29985dab (diff) | |
| download | ihatemoney-mirror-8615fde00ad4c402a8cad3bd23c7a0e4e3788d32.zip ihatemoney-mirror-8615fde00ad4c402a8cad3bd23c7a0e4e3788d32.tar.gz ihatemoney-mirror-8615fde00ad4c402a8cad3bd23c7a0e4e3788d32.tar.bz2 | |
Merge pull request #161 from zorun/optimise_sql
Optimise sql queries
Diffstat (limited to 'budget/web.py')
| -rw-r--r-- | budget/web.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/budget/web.py b/budget/web.py index 63fbe4d..87aef26 100644 --- a/budget/web.py +++ b/budget/web.py @@ -15,6 +15,7 @@ from flask.ext.mail import Mail, Message from flask.ext.babel import get_locale, gettext as _ from smtplib import SMTPRecipientsRefused import werkzeug +from sqlalchemy import orm # local modules from models import db, Project, Person, Bill @@ -277,7 +278,8 @@ def list_bills(): # set the last selected payer as default choice if exists if 'last_selected_payer' in session: bill_form.payer.data = session['last_selected_payer'] - bills = g.project.get_bills() + # Preload the "owers" relationship for all bills + bills = g.project.get_bills().options(orm.subqueryload(Bill.owers)) return render_template("list_bills.html", bills=bills, member_form=MemberForm(g.project), |
