Skip to content

HKTangShuo/pagination

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

快速分页功能

页面效果

avatar

avatar

使用示例

Django视图

def issues(request, project_id):
    if request.method == "GET":
        queryset = Issues.objects.filter(project_id=project_id)
        page_object = Pagination(
            current_page=request.GET.get('page'),
            all_count=queryset.count(),
            base_url=request.path_info,
            query_params=request.GET,
        )
        object_list = queryset[page_object.start:page_object.end]
        form = IssuesModelForm(request)
        context = {
            'issues_object_list': object_list,
            'page_html': mark_safe(page_object.page_html())

        }

        return render(request, 'issues.html', {'context': context})

前端html

<nav aria-label="...">
    <ul class="pagination" style="margin-top: 0;">
      {{ context.page_html }}
    </ul>
</nav>

About

分页组件,快速实现分页功能

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages