Skip to content

Clearing page length user preference breaks pagination #16173

@devon-mar

Description

@devon-mar

Deployment Type

Self-hosted

NetBox Version

v4.0.2

Python Version

3.10

Steps to Reproduce

  1. Create a new user account
  2. Visit a page that uses pagination. It should load properly.
  3. Open /user/preferences/ and click the "X" on Page length.
  4. Click Save.
  5. Visit the page in step 2. An error should occur.

Expected Behavior

The page should load without an error.

Observed Behavior

<class 'TypeError'>

'<' not supported between instances of 'int' and 'str'

Python version: 3.10.14
NetBox version: 4.0.2
Plugins: 
  netbox_demo: 0.5.0

I believe this is because the paginate.per_page preference is an empty string:

GET /api/users/config/

{
    "ui": {
        "htmx_navigation": ""
    },
    "locale": {
        "language": ""
    },
    "pagination": {
        "per_page": "",
        "placement": "bottom"
    },
    "data_format": "json"
}

Therefore, per_page is set to "" instead of config.PAGINATE_COUNT:

per_page = request.user.config.get('pagination.per_page', config.PAGINATE_COUNT)

Metadata

Metadata

Assignees

Labels

severity: mediumResults in substantial degraded or broken functionality for specfic workflowsstatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions