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)]
|
||||
|
||||
def queryFilter(self):
|
||||
return ExperimentMark.group_experiment.has(
|
||||
GroupExperiment.semester_experiment.has(
|
||||
and_(
|
||||
SemesterExperiment.semester == current_user.active_semester,
|
||||
SemesterExperiment.assistants.any(Assistant.user == current_user),
|
||||
)
|
||||
)
|
||||
def query_modifier(self, query):
|
||||
return (
|
||||
query.join(GroupExperiment)
|
||||
.join(SemesterExperiment)
|
||||
.where(SemesterExperiment.semester == current_user.active_semester)
|
||||
.join(SemesterExperiment.assistants)
|
||||
.where(Assistant.user == current_user)
|
||||
)
|
||||
|
||||
def update_model(self, form, model):
|
||||
|
@ -180,8 +179,8 @@ class AssistantUserView(SecureAssistantModelView):
|
|||
"assistant.semester_experiments": "Semester Experiments",
|
||||
}
|
||||
|
||||
def queryFilter(self):
|
||||
return User.id == current_user.id
|
||||
def query_modifier(self, query):
|
||||
return query.where(User.id == current_user.id)
|
||||
|
||||
def on_model_change(self, form, model, is_created):
|
||||
if form.generate_new_password.data:
|
||||
|
|
Loading…
Reference in a new issue