From d6eb16a398a8d3a2f58399fd40df7f212680cab0 Mon Sep 17 00:00:00 2001 From: Michael Manfre Date: Mon, 5 Dec 2022 12:55:30 -0500 Subject: Added caching and initial settings --- users/views/settings/interface.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'users/views/settings') diff --git a/users/views/settings/interface.py b/users/views/settings/interface.py index 5c4f229..e8c73a6 100644 --- a/users/views/settings/interface.py +++ b/users/views/settings/interface.py @@ -21,7 +21,7 @@ class SettingsPage(FormView): options_class = Config.IdentityOptions template_name = "settings/settings.html" section: ClassVar[str] - options: dict[str, dict[str, str]] + options: dict[str, dict[str, str | int]] layout: dict[str, list[str]] def get_form_class(self): @@ -51,6 +51,10 @@ class SettingsPage(FormView): choices = details.get("choices") if choices: field_kwargs["widget"] = forms.Select(choices=choices) + for int_kwarg in {"min_value", "max_value", "step_size"}: + val = details.get(int_kwarg) + if val: + field_kwargs[int_kwarg] = val form_field = forms.IntegerField else: raise ValueError(f"Cannot render settings type {config_field.type_}") -- cgit v1.2.3