How to use the robotframework.models.Webcase.objects.get_queryset function in robotframework

To help you get started, we’ve selected a few robotframework examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Wesly-Yu / AutoZone / robotframework / webviews.py View on Github external
def web_testcase_page(request):
    username = request.session.get('user', '')
    webcases = Webcase.objects.get_queryset().order_by('id')
    paginator = Paginator(webcases, 12)  # 生成paginator对象,设置每页显示15条记录
    page = request.GET.get('page', 1)  # 获取当前页为第1页
    currentPage = int(page)  # 把当前页转换成整数
    try:
        webcases = paginator.page(page)  # 获取当前页码数的记录列表
    except PageNotAnInteger:
        webcases = paginator.page(1)  # 如果输入的页数不是整数则显示第1页内容
    except EmptyPage:
        webcases = paginator.page(paginator.num_pages)  # 如果输入的的页数不在系统的页数中,则显示最后一页
    return render(request, "Web_test_robotframework.html", {"user": username, "webcases": webcases})