diff --git a/netbox/templates/users/preferences.html b/netbox/templates/users/preferences.html index 06a48b431..2a34f1b3f 100644 --- a/netbox/templates/users/preferences.html +++ b/netbox/templates/users/preferences.html @@ -8,20 +8,29 @@
{% csrf_token %} - {% comment %} {% for group, fields in form.Meta.fieldsets %}
{{ group }}
{% for name in fields %} - {% render_field form|getfield:name %} + {% render_field form|getfield:name %} {% endfor %}
{% endfor %} - {% endcomment %} - {% render_form form %} + {% with plugin_fields=form.plugin_fields %} + {% if plugin_fields %} +
+
+
Plugins
+
+ {% for name in plugin_fields %} + {% render_field form|getfield:name %} + {% endfor %} +
+ {% endif %} + {% endwith %}
Cancel diff --git a/netbox/users/forms.py b/netbox/users/forms.py index a6c606c4b..70e300a8c 100644 --- a/netbox/users/forms.py +++ b/netbox/users/forms.py @@ -44,6 +44,15 @@ class UserConfigForm(BootstrapMixin, forms.ModelForm, metaclass=UserConfigFormMe class Meta: model = UserConfig fields = () + fieldsets = ( + ('User Interface', ( + 'pagination.per_page', + 'ui.colormode', + )), + ('Miscellaneous', ( + 'data_format', + )), + ) def __init__(self, *args, instance=None, **kwargs): @@ -61,6 +70,12 @@ class UserConfigForm(BootstrapMixin, forms.ModelForm, metaclass=UserConfigFormMe return super().save(*args, **kwargs) + @property + def plugin_fields(self): + return [ + name for name in self.fields.keys() if name.startswith('plugins.') + ] + class TokenForm(BootstrapMixin, forms.ModelForm): key = forms.CharField(