当前位置: 首页>>代码示例>>Python>>正文


Python Method.getNextPageNum方法代码示例

本文整理汇总了Python中sellcard.common.Method.getNextPageNum方法的典型用法代码示例。如果您正苦于以下问题:Python Method.getNextPageNum方法的具体用法?Python Method.getNextPageNum怎么用?Python Method.getNextPageNum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sellcard.common.Method的用法示例。


在下文中一共展示了Method.getNextPageNum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: index

# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getNextPageNum [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())
开发者ID:KGPython,项目名称:kggroup,代码行数:69,代码来源:saleGroupByOrder.py


注:本文中的sellcard.common.Method.getNextPageNum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。