mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
Use query_modifier in assistantSpace
This commit is contained in:
parent
56c7212323
commit
1ba0659f71
1 changed files with 9 additions and 10 deletions
|
@ -112,14 +112,13 @@ class AssistantExperimentMarkView(SecureAssistantModelView):
|
||||||
|
|
||||||
column_default_sort = [("oral_mark", False), ("protocol_mark", False)]
|
column_default_sort = [("oral_mark", False), ("protocol_mark", False)]
|
||||||
|
|
||||||
def queryFilter(self):
|
def query_modifier(self, query):
|
||||||
return ExperimentMark.group_experiment.has(
|
return (
|
||||||
GroupExperiment.semester_experiment.has(
|
query.join(GroupExperiment)
|
||||||
and_(
|
.join(SemesterExperiment)
|
||||||
SemesterExperiment.semester == current_user.active_semester,
|
.where(SemesterExperiment.semester == current_user.active_semester)
|
||||||
SemesterExperiment.assistants.any(Assistant.user == current_user),
|
.join(SemesterExperiment.assistants)
|
||||||
)
|
.where(Assistant.user == current_user)
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_model(self, form, model):
|
def update_model(self, form, model):
|
||||||
|
@ -180,8 +179,8 @@ class AssistantUserView(SecureAssistantModelView):
|
||||||
"assistant.semester_experiments": "Semester Experiments",
|
"assistant.semester_experiments": "Semester Experiments",
|
||||||
}
|
}
|
||||||
|
|
||||||
def queryFilter(self):
|
def query_modifier(self, query):
|
||||||
return User.id == current_user.id
|
return query.where(User.id == current_user.id)
|
||||||
|
|
||||||
def on_model_change(self, form, model, is_created):
|
def on_model_change(self, form, model, is_created):
|
||||||
if form.generate_new_password.data:
|
if form.generate_new_password.data:
|
||||||
|
|
Loading…
Reference in a new issue