diff options
author | Michael Manfre | 2022-12-05 12:55:30 -0500 |
---|---|---|
committer | GitHub | 2022-12-05 10:55:30 -0700 |
commit | d6eb16a398a8d3a2f58399fd40df7f212680cab0 (patch) | |
tree | 5561d7c7d33850672e300ba4320ece1e588dbb1b /users/views/settings | |
parent | a9bb4a7122df6d9d4a764de52244c6ec75789ead (diff) | |
download | takahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.tar.gz takahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.tar.bz2 takahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.zip |
Added caching and initial settings
Diffstat (limited to 'users/views/settings')
-rw-r--r-- | users/views/settings/interface.py | 6 |
1 files changed, 5 insertions, 1 deletions
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_}") |