class testViewMain():
column_list = [
'first_name',
'last_name',
'email',
'phone',
]
How can I exclude certain values on this flask view?
For example, display only rows from the database where first_name != John and last_name != Doe
.
I thought the function I was looking for is on_form_prefill
, but according to the documentation, this is only on the edit view.
I found an answer:
class testViewMain():
column_list = [
'first_name',
'last_name',
'email',
'phone',
]
def get_query(self):
return self.session.query(self.model).filter(
self.model.first_name != 'John' \
and self.model.last_name != 'Doe')