Pegase745 / sqlalchemy-datatables

SQLAlchemy integration of jQuery DataTables >= 1.10.x (Pyramid and Flask examples)
MIT License
159 stars 67 forks source link

model object is fetched with datatables #125

Closed sachinwhiteman7 closed 4 years ago

Pegase745 commented 4 years ago

@sachinwhiteman7 does your issue seem readable to you ?

Please don't use the title section in order to describe your issue.

sachinwhiteman7 commented 4 years ago

@Pegase745 i'm trying to fetch a table using datatables, i have defined three columns (id, phone and status ), but i'm getting a result like this, [(<Block 11>, 11, '7735353545', 'blocked')] first element is a model object, how can i remove that

sachinwhiteman7 commented 4 years ago

my file looks like this,

columns = [ColumnDT(Block.id), ColumnDT(Block.phonenumber), ColumnDT(Block.status), ] query = Block.query.filter() row_table = DataTables(request.args, query, columns) return jsonify(row_table.output_result())

sachinwhiteman7 commented 4 years ago

and i'm getting this error

TypeError: Object of type 'Block' is not JSON serializable

sachinwhiteman7 commented 4 years ago

it worked when i changed to query = db.session.query().select_from(Block).filter()