Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/rest_framework/checks.py: 80%

8 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-07-17 14:22 -0600

1from django.core.checks import Tags, Warning, register 

2 

3 

4@register(Tags.compatibility) 

5def pagination_system_check(app_configs, **kwargs): 

6 errors = [] 

7 # Use of default page size setting requires a default Paginator class 

8 from rest_framework.settings import api_settings 

9 if api_settings.PAGE_SIZE and not api_settings.DEFAULT_PAGINATION_CLASS: 9 ↛ 10line 9 didn't jump to line 10, because the condition on line 9 was never true

10 errors.append( 

11 Warning( 

12 "You have specified a default PAGE_SIZE pagination rest_framework setting, " 

13 "without specifying also a DEFAULT_PAGINATION_CLASS.", 

14 hint="The default for DEFAULT_PAGINATION_CLASS is None. " 

15 "In previous versions this was PageNumberPagination. " 

16 "If you wish to define PAGE_SIZE globally whilst defining " 

17 "pagination_class on a per-view basis you may silence this check.", 

18 id="rest_framework.W001" 

19 ) 

20 ) 

21 return errors