Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlalchemy.exc.InvalidRequestError when add a filter and apply #1867

Open
e271828182 opened this issue Jun 7, 2019 · 0 comments
Open

sqlalchemy.exc.InvalidRequestError when add a filter and apply #1867

e271828182 opened this issue Jun 7, 2019 · 0 comments

Comments

@e271828182
Copy link

model.py
`
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Column, String

db = SQLAlchemy()

class User(db.Model):
tablename = 'ding_user'

id = Column(String(50), primary_key=True, nullable=False)
user_code = Column(String(10), nullable=False)
phone = Column(String(20), nullable=False)
name = Column(String(20), nullable=False)

view.py
from flask_admin.contrib.sqla import ModelView
from flask_admin.contrib.sqla.filters import FilterEqual

from model import User

class UserModelView(ModelView):
column_list = ('phone', 'name')
column_filters = (FilterEqual(column=User.phone, name='Phone'),)`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant