本文整理匯總了Python中sellcard.common.Method.getPrevPageNum方法的典型用法代碼示例。如果您正苦於以下問題:Python Method.getPrevPageNum方法的具體用法?Python Method.getPrevPageNum怎麽用?Python Method.getPrevPageNum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sellcard.common.Method
的用法示例。
在下文中一共展示了Method.getPrevPageNum方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: index
# 需要導入模塊: from sellcard.common import Method [as 別名]
# 或者: from sellcard.common.Method import getPrevPageNum [as 別名]
def index(request):
role_id = request.session.get('s_roleid')
s_shop = request.session.get('s_shopcode')
s_depart = request.session.get('s_depart')
s_user = request.session.get('s_uid')
today = str(datetime.date.today())
start = end = today
actionType = 1
shops = []
users = AdminUser.objects.values('id', 'name','is_enable').filter(role_id__in=('2', '3','5','11'))
if role_id in ('1','6'):
shops = mth.getCityShopsCode()
elif role_id == '9':
shops = mth.getCityShopsCode('T')
elif role_id == '8':
shops = mth.getCityShopsCode('C')
elif role_id in ('2', '10'):
shops = [s_shop]
elif role_id in ('3', '5'):
shopcode = s_shop
depart = s_depart
operator = s_user
personList = users.filter(shop_code__in=shops)
personList = sorted(personList, key=lambda p: p["name"].encode('gb2312'))
departs = base.findDepart()
if request.method == 'POST':
shop,operator,depart = '','',''
if role_id in ('1','6','8','9'):
shop = request.POST.get('shop','')
depart = request.POST.get('depart', '')
operator = request.POST.get('operator', '')
elif role_id in ('2','10') :
shop = s_shop
depart = request.POST.get( 'depart', '')
operator = request.POST.get('operator', '')
elif role_id in ('3','5'):
shop = s_shop
depart = s_depart
operator = s_user
actionType = request.POST.get('actionType','1')
start = request.POST.get('start',today)
end = request.POST.get('end',today)
endTime = datetime.datetime.strptime(end,'%Y-%m-%d') + datetime.timedelta(1)
page = request.POST.get('page',1)
kwargs = {}
if shop:
kwargs.setdefault('shop_code',shop)
if operator:
kwargs.setdefault('operator_id',operator)
if depart:
kwargs.setdefault('depart',depart)
kwargs.setdefault('add_time__gte',start)
kwargs.setdefault('add_time__lte',endTime)
resList, paidTotal, discTotal, cardCount = getData(actionType,kwargs)
paginator = Paginator(resList,20)
try:
resList = paginator.page(page)
page_next = mth.getNextPageNum(resList)
page_prev = mth.getPrevPageNum(resList)
except Exception as e:
print(e)
return render(request, 'report/card/saleGroupByOrder/index.html', locals())