Using Python backend
Using Python backend
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem: Hi!
I'm trying to use a Python backend, but I need some more documentation.
A complete example with .html, .js and relevant parts of the .py would be really nice. I've looked through published examples on datatables.net, but do not find anything like this.
I have imported the relevant libraries in my .py, I hope:
from sqlalchemy import create_engine
from datatables_server import Editor, Field, DataTable, Column
Answers
There aren't any Python docs on this site. The docs for the Python library (datatables_server) should have config samples, etc. Are you using this library?
Essentially you would configure a route, example from the above library's docs:
Then configure the Datatable to use ajax and build the table using the JSON repsonse, like this example pointing to your route. Like this:
Datatables and the Editor don't have knowledge of the backend so their docs won't change due to using Python. Refer to the Python library's docs for setting up the server side code.
I can try to anwer any Python questions you have but this forum isn't setup for Python support. Please let us know of any Datatables or Editor questions you have.
Kevin
A small correction, the documentation for the DataTables Python libraries is available here and you can download a demo Editor application for Python here. That includes all of the Editor demos (nearly all of the other examples on the site are client-side specific configuration, and thus are backend independent).
The one catch at the moment is that the upload for the Python libraries doesn't work. That is something I'll work on.
Allan
Wow, I didn't know you created a Python library. That's great!
Kevin
Thank you for a good answer. I'll be working on it!
Peter
...and yes, it's the Python library you referred to,, I'm trying to learn. (After some years with the PHP solution).
New server, or just for a chance of scene?
No, not just change of scene. Trying to weed out PHP on our system.
BTW: The datetime picker is really good. I can manually enter dates back to the 1500's as I need to. But how do I show that range of years in the picker? (Yes, I know: Julian and Gregorian dates.... But for this purpose we don't really care!)
The year range option is the one that controls the list of dates shown in the drop down. I will say up front though, that the date picker isn't particularly well optimised for dates outside 25 years or so from now, since it results in a really long
selectlist.I was going to suggest looking at the
<input type="date">tag, but, at least in Firefox, its year input is even worse.You might want to take a look around at various date pickers and see what would work best for you - I've seen some that let you "zoom out" for example, doing back to pick a century, then decade, then year, which might work better for you. Creating a field type plugin for Editor is a relatively simple process.
Allan
Thanks! I'll look into that!
Peter