2
0

view_random.py 463 B

12345678910111213
  1. from .tool.func import *
  2. def view_random():
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. curs.execute(db_change("" + \
  6. "select title from data " + \
  7. "where title not like 'user:%' and title not like 'category:%' and title not like 'file:%' " + \
  8. "order by random() limit 1" + \
  9. ""))
  10. data = curs.fetchall()
  11. return redirect('/w/' + url_pas(data[0][0])) if data else redirect()