Document available user preferences

This commit is contained in:
Jeremy Stretch 2020-04-24 09:23:58 -04:00
parent 30c3d6ee40
commit d8494e44e7
4 changed files with 30 additions and 2 deletions

View File

@ -0,0 +1,9 @@
# User Preferences
The `users.UserConfig` model holds individual preferences for each user in the form of JSON data. This page serves as a manifest of all recognized user preferences in NetBox.
## Available Preferences
| Name | Description |
| ---- | ----------- |
| pagination.per_page | The number of items to display per page of a paginated table |

View File

@ -72,6 +72,7 @@ nav:
- Utility Views: 'development/utility-views.md'
- Extending Models: 'development/extending-models.md'
- Application Registry: 'development/application-registry.md'
- User Preferences: 'development/user-preferences.md'
- Release Checklist: 'development/release-checklist.md'
- Squashing Migrations: 'development/squashing-migrations.md'
- Release Notes:

View File

@ -0,0 +1,18 @@
{% extends 'users/_user.html' %}
{% load helpers %}
{% block title %}User Preferences{% endblock %}
{% block usercontent %}
<table class="table table-striped">
<thead>
<tr>
<th>Preference</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for %}
</tbody>
</table>
{% endblock %}

View File

@ -50,9 +50,9 @@ def get_paginate_count(request):
if 'per_page' in request.GET:
try:
per_page = int(request.GET.get('per_page'))
request.user.config.set('paginate_count', per_page, commit=True)
request.user.config.set('pagination.per_page', per_page, commit=True)
return per_page
except ValueError:
pass
return request.user.config.get('paginate_count', settings.PAGINATE_COUNT)
return request.user.config.get('pagination.per_page', settings.PAGINATE_COUNT)