(request)
return render(request, 'fm/rules.html', {'frules': frules,
                                             'page_content': page_content,
                                             'vendor_list': vendor_list})
FM模块规则页面主页
FM模块规则页面主页
FM模块规则页面主页
def frules_index(request):
    """ FM模块规则页面主页 """
    limit = 12  # 每页所显示的规则数量
    rules = FRule.objects.order_by('-add_time').all()
    paginator = Paginator(rules, limit)
    page = request.GET.get('page')
    try:
        frules = paginator.page(page)
    except PageNotAnInteger:
        frules = paginator.page(1)
    except EmptyPage:
        frules = paginator.page(paginator.num_pages)

    page_content = pagination(frules)

    # vendor list
    vendor_list = Vendor.objects.all()
    return render(request, 'fm/rules.html', {'frules': frules,
                                             'page_content': page_content,
                                             'vendor_list': vendor_list})
def frules_index ( request ) : limit = 12 # 每页所显示的规则数量 rules = FRule . objects . order_by ( '-add_time' ) . all ( ) paginator = Paginator ( rules , limit ) page = request . GET . get ( 'page' ) try : frules = paginator . page ( page ) except PageNotAnInteger : frules = paginator . page ( 1 ) except EmptyPage : frules = paginator . page ( paginator . num_pages ) page_content = pagination ( frules ) # vendor list vendor_list = Vendor . objects . all ( ) return render ( request , 'fm/rules.html' , { 'frules' : frules , 'page_content' : page_content , 'vendor_list' : vendor_list } )