Details
-
Type: Bug
-
Status: New
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: Current Version
-
Fix Version/s: None
-
Component/s: OIOIOI
-
Labels:None
Description
Following changes added `PreferenceFactory` class that is used to generate preference forms, currently used to generate edit profile view form:
https://jira.sio2project.mimuw.edu.pl/browse/SIO-1624
https://gerrit.sio2project.mimuw.edu.pl/#/c/2291/
Currently only place where `add_field` method is used is inside:
1. base/forms.py > _maybe_add_field
2. base/views.py > adjust_preferences_factory_fields
3. tests
Two improvements have to be made:
1. `_maybe_add_field` function takes label strings from settings, where they are translated. Functionality should be added to automatically translate labels in `PreferenceFactory` and move translation logic out of settings. It should be considered if label names shouldn't be moved from settings entirely.
Alternatively field labes can be made into positional parameter, and translation will occur in caller.
2. With addition of `UserPreferences` model `PreferenceFactory` needs functionality to automatically add fields from `UserPreferences`, similarly to how forms can be automatically generated from models.
It is currently made manually inside `adjust_preferences_factory_fields` which can badly impact future refactor/updates.
https://jira.sio2project.mimuw.edu.pl/browse/SIO-1624
https://gerrit.sio2project.mimuw.edu.pl/#/c/2291/
Currently only place where `add_field` method is used is inside:
1. base/forms.py > _maybe_add_field
2. base/views.py > adjust_preferences_factory_fields
3. tests
Two improvements have to be made:
1. `_maybe_add_field` function takes label strings from settings, where they are translated. Functionality should be added to automatically translate labels in `PreferenceFactory` and move translation logic out of settings. It should be considered if label names shouldn't be moved from settings entirely.
Alternatively field labes can be made into positional parameter, and translation will occur in caller.
2. With addition of `UserPreferences` model `PreferenceFactory` needs functionality to automatically add fields from `UserPreferences`, similarly to how forms can be automatically generated from models.
It is currently made manually inside `adjust_preferences_factory_fields` which can badly impact future refactor/updates.