[Flask] Allow user to sort DB output

Alexandru alexandru at bluemasters.ro
Tue Aug 11 08:53:14 CEST 2015


Hello everyone,

I've built a small Flask app that basically requires a a lot of database 
interaction.
I'm almost done with it now, I just need a way for the user to sort the 
information that's received from the database (order by name, price, 
location, etc)
The problem is I'm not that good at coding yet and I'm not sure how to 
go about doing this.

I'm not going to paste my code here, to avoid clutter, so I'm going to 
use Pastebin

This is the section of code that interogates the DB: 
http://pastebin.com/W76H0TSK
And this is the template portion of the code: http://pastebin.com/BsCHiU3z

I'm looking to insert anchors, or buttons, or something, into that 
template that would allow the users to sort by (for example) pct_lucru 
and/or data_expirarii and/or denumire_med.

Any ideas for me? I'm kind of stumped.

Cheers!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20150811/6aec1197/attachment.html>


More information about the Flask mailing list