diff --git a/netbox/netbox/preferences.py b/netbox/netbox/preferences.py
index 1414ea850..aa37bffae 100644
--- a/netbox/netbox/preferences.py
+++ b/netbox/netbox/preferences.py
@@ -22,6 +22,7 @@ PREFERENCES = {
('dark', _('Dark')),
),
default='light',
+ description=_('Preferred default UI theme')
),
'ui.htmx_navigation': UserPreference(
label=_('HTMX Navigation'),
@@ -29,14 +30,17 @@ PREFERENCES = {
('', _('Disabled')),
('true', _('Enabled')),
),
- default=False
+ description=_('Enable dynamic UI navigation'),
+ default=False,
+ experimental=True
),
'locale.language': UserPreference(
label=_('Language'),
choices=(
('', _('Auto')),
*settings.LANGUAGES,
- )
+ ),
+ description=_('Forces UI translation to the specified language.')
),
'pagination.per_page': UserPreference(
label=_('Page length'),
@@ -51,8 +55,8 @@ PREFERENCES = {
('top', _('Top')),
('both', _('Both')),
),
- description=_('Where the paginator controls will be displayed relative to a table'),
- default='bottom'
+ default='bottom',
+ description=_('Where the paginator controls will be displayed relative to a table')
),
# Miscellaneous
@@ -62,6 +66,7 @@ PREFERENCES = {
('json', 'JSON'),
('yaml', 'YAML'),
),
+ description=_('The preferred syntax for displaying generic data within the UI')
),
}
diff --git a/netbox/templates/account/preferences.html b/netbox/templates/account/preferences.html
index 5f63c328e..0276b9adb 100644
--- a/netbox/templates/account/preferences.html
+++ b/netbox/templates/account/preferences.html
@@ -39,30 +39,32 @@
{% trans "Clear table preferences" %}
{% else %}
diff --git a/netbox/users/forms/model_forms.py b/netbox/users/forms/model_forms.py
index 7320e603b..b14300d80 100644
--- a/netbox/users/forms/model_forms.py
+++ b/netbox/users/forms/model_forms.py
@@ -3,7 +3,7 @@ from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.postgres.forms import SimpleArrayField
from django.core.exceptions import FieldError
-from django.utils.html import mark_safe
+from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
from core.models import ObjectType
@@ -37,7 +37,14 @@ class UserConfigFormMetaclass(forms.models.ModelFormMetaclass):
preference_fields = {}
for field_name, preference in PREFERENCES.items():
description = f'{preference.description}
' if preference.description else ''
- help_text = f'{description}{field_name}
'
+ help_text = f'{field_name}
'
+ if preference.description:
+ help_text = f'{preference.description}
{help_text}'
+ if preference.experimental:
+ help_text = (
+ f' Experimental feature
'
+ f'{help_text}'
+ )
field_kwargs = {
'label': preference.label,
'choices': preference.choices,
diff --git a/netbox/users/preferences.py b/netbox/users/preferences.py
index cff6a3c9b..3eab4cb6e 100644
--- a/netbox/users/preferences.py
+++ b/netbox/users/preferences.py
@@ -2,9 +2,10 @@ class UserPreference:
"""
Represents a configurable user preference.
"""
- def __init__(self, label, choices, default=None, description='', coerce=lambda x: x):
+ def __init__(self, label, choices, default=None, description='', coerce=lambda x: x, experimental=False):
self.label = label
self.choices = choices
self.default = default if default is not None else choices[0]
self.description = description
self.coerce = coerce
+ self.experimental = experimental