Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
6593a567
Commit
6593a567
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
DB: Ještě jeden preload
parent
7554d23f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/web/main.py
+5
-2
5 additions, 2 deletions
mo/web/main.py
with
5 additions
and
2 deletions
mo/web/main.py
+
5
−
2
View file @
6593a567
...
@@ -2,6 +2,7 @@ from flask import render_template, request, g, redirect, url_for, session
...
@@ -2,6 +2,7 @@ from flask import render_template, request, g, redirect, url_for, session
from
flask_wtf
import
FlaskForm
from
flask_wtf
import
FlaskForm
import
wtforms
import
wtforms
import
wtforms.validators
as
validators
import
wtforms.validators
as
validators
from
sqlalchemy.orm
import
joinedload
import
mo.db
as
db
import
mo.db
as
db
import
mo.rights
import
mo.rights
...
@@ -108,8 +109,10 @@ def reset():
...
@@ -108,8 +109,10 @@ def reset():
@app.route
(
'
/
'
)
@app.route
(
'
/
'
)
def
index
():
def
index
():
sess
=
db
.
get_session
()
sess
=
db
.
get_session
()
# FIXME: Preloadovat místa
roles
=
[]
roles
=
[]
if
g
.
user
:
if
g
.
user
:
roles
=
sess
.
query
(
db
.
UserRole
).
filter_by
(
user_id
=
g
.
user
.
user_id
).
all
()
roles
=
(
sess
.
query
(
db
.
UserRole
)
.
filter_by
(
user_id
=
g
.
user
.
user_id
)
.
options
(
joinedload
(
db
.
UserRole
.
place_object
))
.
all
())
return
render_template
(
'
main.html
'
,
roles
=
roles
,
roles_by_type
=
mo
.
rights
.
roles_by_type
)
return
render_template
(
'
main.html
'
,
roles
=
roles
,
roles_by_type
=
mo
.
rights
.
roles_by_type
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment