简体   繁体   中英

Django: Django-Rest-Framework gives Attribution error (pagination)

I'm trying to create migrations of a project which uses Rest Framework pagination .

But I'm getting error as Attribution error: 'module' object has no attribute BasePaginationSerializer . I have tried uninstalling-resinstalling the said versions of Python, Django and 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

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

  • I'm using Ubuntu 15.10
  • Python - 2.7.10
  • 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. You probably want to use BasePagination

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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