From 2e04a88d9a8deb3bccd8934b462134829e951493 Mon Sep 17 00:00:00 2001 From: Doug Le Tough Date: Sun, 22 Oct 2017 09:01:42 +0200 Subject: [PATCH] "old stable" --- static/images/search.png | Bin 0 -> 371 bytes static/style/style.css | 23 ++++++++------ templates/componants.html | 64 ++++++++++++++++++++++++++++++++++++-- tetastock.py | 16 +++++++--- 4 files changed, 86 insertions(+), 17 deletions(-) create mode 100644 static/images/search.png diff --git a/static/images/search.png b/static/images/search.png new file mode 100644 index 0000000000000000000000000000000000000000..7eb60c5ee00d589e28567b1572807f556466cf20 GIT binary patch literal 371 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=DjSL74G){)!Z!AbW|YuPggQE-_Xv)?pwYK;OSI zAvIa~n%S*r7M(2~)1QUjJ8&u_Q}iR(H>Zx?Ne_7UG$bU7G`--|aS`xLPBMO^ZKiK% zuk+^2n?J_?&wOgV9uUrcudi3LmzX^14S;CiLReyvx4t^F`OZ`-u-Em zYq@uYv$g0Om)oa}Rm67qv$ieVIiopc%BA@arDtcHQ}8(T=IEAk!_K^*8^?pSE_8$* zbe*t8=xSWSETt34=l^b)UAX^9*pG8f6-!^~^CX43p4{Jl-9zrN@ZD96Ta!ZListe des composants + +

Recherche:

+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +

Résultat

@@ -39,8 +97,8 @@ {{ componant.quantity }} {{ componant.place }}
- - + +
{% endfor %} diff --git a/tetastock.py b/tetastock.py index e5f09ae..958e95e 100755 --- a/tetastock.py +++ b/tetastock.py @@ -7,7 +7,7 @@ from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config.from_pyfile('config.py') -app.secret_key = app.config.get('446307a5f61c2bb810436b2ee0f903f2') +app.secret_key = '446307a5f61c2bb810436b2ee0f903f2' app.debug = True app.static_url_path='/static' db = SQLAlchemy(app) @@ -61,7 +61,9 @@ def authenticate(): ######################################################################## @app.route('/componants', methods=['GET', 'POST']) def get_componants(): - limit = 16 + if not session or not session['plop']: + session['plop']='plip' + limit = 8 offset = 0 sort = 'reference' order = 'asc' @@ -78,6 +80,7 @@ def get_componants(): offset = int(offset) except ValueError: offset = 0 + providers = Stock_providers.query.order_by(Stock_providers.name).all() row_count = db.session.query(Stock_componants.id).count() page_count = int(math.ceil(row_count / float(limit))) page = int(math.ceil(float(offset + 1) / float(limit))) @@ -95,6 +98,7 @@ def get_componants(): componants = Stock_componants.query.order_by(getattr(Stock_componants, sort).desc()).offset(offset).limit(limit).all() return render_template('componants.html', componants=componants, + providers = providers, offset=offset, nexthop=nexthop, prevhop=prevhop, @@ -106,6 +110,7 @@ def get_componants(): @app.route('/componants/') def get_componant(componant_id): + print session['plop'] try: componant_id = int(componant_id) except ValueError as e: @@ -236,8 +241,9 @@ def search_users(): return render_template('wip.html') ############################################## - -def get_distinct(query): +# SQL +############################################## +def sql_get_distinct(query): results = [] for result in query: result = result[0] @@ -248,4 +254,4 @@ def get_distinct(query): # Main ####################################### if __name__ == '__main__': - app.run() + app.run(host='0.0.0.0')