Pagination and Filtering

2017-02-02 Thread Thiago Mambretti
Hi all,

Is it possible to use the default pagination backend along with the 
following filters?

'django_filters.rest_framework.DjangoFilterBackend',
'rest_framework.filters.SearchFilter',
'rest_framework.filters.OrderingFilter',


I'm using a ModelViewSet and the API only when I have only the pagination 
or the filters activated.

There's no mention on anything about it on the docs so came here for help.

Thanks,

 



-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pagination and Filtering

2017-02-02 Thread Xavier Ordoquy
Hi,

I can’t think of a reason why they wouldn’t work in particular  if the 
documentation doesn’t says otherwise.
Any specific issue that makes you think they don’t ?

Regards,
Xavier Ordoquy,
Linovia.

> Le 2 févr. 2017 à 16:07, Thiago Mambretti  > a écrit :
> 
> Hi all,
> 
> Is it possible to use the default pagination backend along with the following 
> filters?
> 
> 'django_filters.rest_framework.DjangoFilterBackend',
> 'rest_framework.filters.SearchFilter',
> 'rest_framework.filters.OrderingFilter',
> 
> I'm using a ModelViewSet and the API only when I have only the pagination or 
> the filters activated.
> 
> There's no mention on anything about it on the docs so came here for help.
> 
> Thanks,
> 
>  
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-rest-framework+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pagination and Filtering

2017-02-02 Thread Thiago Mambretti
Sorry,

The error I'm getting is the following:


Environment:

Request Method: GET
Request URL: http://192.168.1.208:8000/api/states/

Django Version: 1.10.5
Python Version: 2.7.6
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'rest_framework',
 'crispy_forms',
 'apps.geodata',
 'apps.accounts']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File 
"/home/vagrant/.virtualenvs/prospect/local/lib/python2.7/site-packages/django/core/handlers/exception.py"
 
in inner
  39. response = get_response(request)

File 
"/home/vagrant/.virtualenvs/prospect/local/lib/python2.7/site-packages/django/core/handlers/base.py"
 
in _get_response
  187. response = self.process_exception_by_middleware(e, 
request)

File 
"/home/vagrant/.virtualenvs/prospect/local/lib/python2.7/site-packages/django/core/handlers/base.py"
 
in _get_response
  185. response = wrapped_callback(request, *callback_args, 
**callback_kwargs)

File 
"/home/vagrant/.virtualenvs/prospect/local/lib/python2.7/site-packages/django/views/decorators/csrf.py"
 
in wrapped_view
  58. return view_func(*args, **kwargs)

File 
"/home/vagrant/.virtualenvs/prospect/local/lib/python2.7/site-packages/rest_framework/viewsets.py"
 
in view
  83. return self.dispatch(request, *args, **kwargs)

File 
"/home/vagrant/.virtualenvs/prospect/local/lib/python2.7/site-packages/rest_framework/views.py"
 
in dispatch
  477. response = self.handle_exception(exc)

File 
"/home/vagrant/.virtualenvs/prospect/local/lib/python2.7/site-packages/rest_framework/views.py"
 
in handle_exception
  437. self.raise_uncaught_exception(exc)

File 
"/home/vagrant/.virtualenvs/prospect/local/lib/python2.7/site-packages/rest_framework/views.py"
 
in dispatch
  474. response = handler(request, *args, **kwargs)

File 
"/home/vagrant/.virtualenvs/prospect/local/lib/python2.7/site-packages/rest_framework/mixins.py"
 
in list
  42. page = self.paginate_queryset(queryset)

File 
"/home/vagrant/.virtualenvs/prospect/local/lib/python2.7/site-packages/rest_framework/generics.py"
 
in paginate_queryset
  170. if self.paginator is None:

File 
"/home/vagrant/.virtualenvs/prospect/local/lib/python2.7/site-packages/rest_framework/generics.py"
 
in paginator
  163. self._paginator = self.pagination_class()

Exception Type: TypeError at /api/states/
Exception Value: 'list' object is not callable







On Thursday, February 2, 2017 at 12:07:00 PM UTC-3, Thiago Mambretti wrote:
>
> Hi all,
>
> Is it possible to use the default pagination backend along with the 
> following filters?
>
> 'django_filters.rest_framework.DjangoFilterBackend',
> 'rest_framework.filters.SearchFilter',
> 'rest_framework.filters.OrderingFilter',
>
>
> I'm using a ModelViewSet and the API only when I have only the pagination 
> or the filters activated.
>
> There's no mention on anything about it on the docs so came here for help.
>
> Thanks,
>
>  
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.