"Bugfix: Pagination"
This commit is contained in:
parent
5fbfd38218
commit
6cf5daf2a1
12
tetastock.py
12
tetastock.py
@ -67,6 +67,7 @@ def resume_session(func):
|
|||||||
order_refresh = 0
|
order_refresh = 0
|
||||||
c_empty = ''
|
c_empty = ''
|
||||||
c_provider = 1
|
c_provider = 1
|
||||||
|
offset_reset = ['c_reference', 'c_designation', 'c_place', 'c_provider']
|
||||||
if not 'c_limit' in session:
|
if not 'c_limit' in session:
|
||||||
session['c_limit'] = limit
|
session['c_limit'] = limit
|
||||||
if not 'c_offest' in session:
|
if not 'c_offest' in session:
|
||||||
@ -91,14 +92,19 @@ def resume_session(func):
|
|||||||
session['c_provider'] = c_provider
|
session['c_provider'] = c_provider
|
||||||
# Cookies/session sync
|
# Cookies/session sync
|
||||||
for key in request.cookies:
|
for key in request.cookies:
|
||||||
|
old = str(session[key])
|
||||||
try:
|
try:
|
||||||
session[key] = int(str(request.cookies[key]))
|
session[key] = int(str(request.cookies[key]))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# Value is not an int, will be treated as string
|
# Value is not an int, will be treated as string
|
||||||
session[key] = str(request.cookies[key])
|
session[key] = str(request.cookies[key])
|
||||||
|
if key in offset_reset and len(str(session[key])) > 0 and old != str(session[key]):
|
||||||
|
session['c_offset'] = 0
|
||||||
|
|
||||||
if key != 'session':
|
if key != 'session':
|
||||||
print '+', key, request.cookies[key]
|
print '+', key, request.cookies[key]
|
||||||
|
|
||||||
|
|
||||||
# Switch sort order
|
# Switch sort order
|
||||||
if session['c_order_refresh'] == 1:
|
if session['c_order_refresh'] == 1:
|
||||||
refresh = {'desc': 'asc', 'asc': 'desc'}
|
refresh = {'desc': 'asc', 'asc': 'desc'}
|
||||||
@ -195,13 +201,13 @@ def out_componants():
|
|||||||
@resume_session
|
@resume_session
|
||||||
def update_componants():
|
def update_componants():
|
||||||
# search by reference
|
# search by reference
|
||||||
like = '%'+str(session['c_reference'])+'%'
|
like = '%s%s%s' % ('%', str(session['c_reference']), '%')
|
||||||
componants = Stock_componants.query.filter(Stock_componants.reference.like(like))
|
componants = Stock_componants.query.filter(Stock_componants.reference.like(like))
|
||||||
# search by designation
|
# search by designation
|
||||||
like = '%'+str(session['c_designation'])+'%'
|
like = '%s%s%s' % ('%', str(session['c_designation']), '%')
|
||||||
componants = componants.filter(Stock_componants.designation.like(like))
|
componants = componants.filter(Stock_componants.designation.like(like))
|
||||||
# search by place
|
# search by place
|
||||||
like = '%'+str(session['c_place'])+'%'
|
like = '%s%s%s' % ('%', str(session['c_place']),'%')
|
||||||
componants = componants.filter(Stock_componants.place.like(like))
|
componants = componants.filter(Stock_componants.place.like(like))
|
||||||
# search by provider
|
# search by provider
|
||||||
if session['c_provider'] > 0:
|
if session['c_provider'] > 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user