简体   繁体   English

Django:Django-Rest-Framework提供归因错误(分页)

[英]Django: Django-Rest-Framework gives Attribution error (pagination)

I'm trying to create migrations of a project which uses Rest Framework pagination . 我正在尝试创建使用Rest Framework分页的项目的迁移。

But I'm getting error as Attribution error: 'module' object has no attribute BasePaginationSerializer . 但是我收到了Attribution error: 'module' object has no attribute BasePaginationSerializer I have tried uninstalling-resinstalling the said versions of Python, Django and RestFramework. 我尝试卸载-重新安装所述版本的Python,Django和RestFramework。 But I still get that error. 但我仍然会收到该错误。

Here's the screenshot of terminal showing error. 这是显示错误的终端屏幕截图。

在此处输入图片说明

Here's a chunk of the code present in paginator.py 这是paginator.py存在的大部分代码

import urlparse

from django.core.paginator import EmptyPage, Page, PageNotAnInteger, Paginator
from django.utils.http import urlencode

from rest_framework import serializers, pagination

class CustomPaginationSerializer(pagination.BasePaginationSerializer):#Here it shows the error.
    meta = MetaSerializer(source='*')
    results_field = 'objects'

Can someone help me out in getting this issue resolved? 有人可以帮我解决此问题吗?

Info: - Here's the project which I'm trying to build. 信息:-这是我要构建的项目。 https://github.com/mozilla/zamboni https://github.com/mozilla/zamboni

  • I'm using Ubuntu 15.10 我正在使用Ubuntu 15.10
  • Python - 2.7.10 Python-2.7.10
  • Django - 1.8.7 的Django-1.8.7

Django Rest Framework doesn't provide anything like BasePaginationSerializer , that's why you're getting an error - because it doesn't exist. Django Rest Framework不提供诸如BasePaginationSerializer之类的BasePaginationSerializer ,这就是为什么会出现错误-因为它不存在。 You probably want to use BasePagination 您可能要使用BasePagination

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM