django 3.2版本文档:

HttpRequest内置API:
https://docs.djangoproject.com/zh-hans/3.2/ref/request-response/
数据库操作API:
https://docs.djangoproject.com/zh-hans/3.2/ref/models/querysets/
带表情的数据写入数据失败怎么解决:
https://blog.qqvbc.com/default/619.html
requests请求远程API代理问题、SSL问题、官方API文档:
https://blog.qqvbc.com/default/613.html
https://requests.readthedocs.io/en/latest/api/
rest风格的框架插件API文档:
https://www.django-rest-framework.org/api-guide/viewsets/

数据分页:

        page = request.POST.get('page')
        limit = request.POST.get('limit')

        querySet = articleModel.objects.all().order_by('-id')
        pager = Paginator(querySet, limit if limit else 10)
        items = []
        for item in pager.page(page if page else 1):
            items.append({id: item.id, title: item.title})

        JsonResponse({'data': data, 'count': pager.count if pager else len(data)})

标签: none

添加新评论