[英]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
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.