Answer the question
In order to leave comments, you need to log in
How to do a search in flask-admin?
I have a simple model.
class Words(db.Model):
id = db.Column(db.Integer, primary_key = True)
russia = db.Column(db.String(50))
english = db.Column(db.String(50))
buttons = db.Column(db.Text())
def __init__(self, russia=None, english=None, buttons=None):
self.russia = russia
self.english = english
self.buttons = buttons
####### Admin ######### Admin ########## Admin ###########################
admin = Admin(app, name="Demo", template_mode='bootstrap3')
admin.add_view(ModelView(Words, db.session))
Answer the question
In order to leave comments, you need to log in
Everything turned out to be simple and not so difficult. Maybe someone needs. Here is the code.
###### Models ######### Models ######## Models ###########
class Words(db.Model):
__tablename__ = 'words'
id = db.Column(db.Integer, primary_key = True)
russia = db.Column(db.String(50))
english = db.Column(db.String(50))
buttons = db.Column(db.Text())
def __init__(self, russia=None, english=None, buttons=None):
self.russia = russia
self.english = english
self.buttons = buttons
class Mytools(ModelView):
column_searchable_list = ['russia']
####### Admin ######### Admin ########## Admin ###########################
admin = Admin(app, name="Demo", template_mode='bootstrap3')
admin.add_view(Mytools(Words, db.session))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question