Просмотр исходного кода

Closes #11807: Restore default page size when navigating between views

jeremystretch 3 лет назад
Родитель
Сommit
cfa6b28ceb
3 измененных файлов с 5 добавлено и 3 удалено
  1. 4 0
      docs/release-notes/version-3.4.md
  2. 1 1
      netbox/netbox/preferences.py
  3. 0 2
      netbox/utilities/paginator.py

+ 4 - 0
docs/release-notes/version-3.4.md

@@ -2,6 +2,10 @@
 
 
 ## v3.4.6 (FUTURE)
 ## v3.4.6 (FUTURE)
 
 
+### Enhancements
+
+* [#11807](https://github.com/netbox-community/netbox/issues/11807) - Restore default page size when navigating between views
+
 ### Bug Fixes
 ### Bug Fixes
 
 
 * [#11796](https://github.com/netbox-community/netbox/issues/11796) - When importing devices, restrict rack by location only if the location field is specified
 * [#11796](https://github.com/netbox-community/netbox/issues/11796) - When importing devices, restrict rack by location only if the location field is specified

+ 1 - 1
netbox/netbox/preferences.py

@@ -24,7 +24,7 @@ PREFERENCES = {
     'pagination.per_page': UserPreference(
     'pagination.per_page': UserPreference(
         label=_('Page length'),
         label=_('Page length'),
         choices=get_page_lengths(),
         choices=get_page_lengths(),
-        description=_('The number of objects to display per page'),
+        description=_('The default number of objects to display per page'),
         coerce=lambda x: int(x)
         coerce=lambda x: int(x)
     ),
     ),
     'pagination.placement': UserPreference(
     'pagination.placement': UserPreference(

+ 0 - 2
netbox/utilities/paginator.py

@@ -76,8 +76,6 @@ def get_paginate_count(request):
     if 'per_page' in request.GET:
     if 'per_page' in request.GET:
         try:
         try:
             per_page = int(request.GET.get('per_page'))
             per_page = int(request.GET.get('per_page'))
-            if request.user.is_authenticated:
-                request.user.config.set('pagination.per_page', per_page, commit=True)
             return _max_allowed(per_page)
             return _max_allowed(per_page)
         except ValueError:
         except ValueError:
             pass
             pass