Closed tecnopolis-ve closed 7 years ago
This is not how I would do it, but if you insist:
from sqlalchemy.sql import literal_column
columns = [
ColumnDT(Location.id),
ColumnDT(Location.name),
ColumnDT(Location.location),
ColumnDT(Location.phone),
ColumnDT(literal_column("'my_custom_url'").label('a_nice_name')),
]
Note that the quotes matter, you have too pass a string wrapped in single quotes to the literal_column
.
I would do personally do this in JS. If you generate the JS from within a template, you can add the flask generated url to to the JS in this way.
@tdamsma thanks a lot!
This information appear in the API? because I wasn't able to find it.
Many thanks again!
Hello
This plugin is very useful! I'm using it with flask and sqlalchemy, but I've a question; how can I put a custom text (in this case, a link) as a column?
For example, I've defined
"Custom URL" is any url generated by flask (edit, more info of current row, etc)
I know that I can personalize the rows using javascript, but certain urls are better if rendered by flask directly.
Any thought or ideas?
Thanks a lot!