Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearing page length user preference breaks pagination #16173

Closed
devon-mar opened this issue May 17, 2024 · 1 comment · Fixed by #16192
Closed

Clearing page length user preference breaks pagination #16173

devon-mar opened this issue May 17, 2024 · 1 comment · Fixed by #16192
Assignees
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@devon-mar
Copy link
Contributor

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)

@devon-mar devon-mar added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels May 17, 2024
@devon-mar
Copy link
Contributor Author

Can I be assigned to this? I have a PR ready to go.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation severity: medium Results in substantial degraded or broken functionality for specfic workflows and removed status: needs triage This issue is awaiting triage by a maintainer labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants