Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Disallow entering negative height in user preferences

Ziqi Lin6e7d8bd78615
diff --git a/wger/core/forms.py b/wger/core/forms.py
index aa423b675..77a19496a 100644
--- a/wger/core/forms.py
+++ b/wger/core/forms.py
@@ -142,6 +142,12 @@ class UserPreferencesForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(UserPreferencesForm, self).__init__(*args, **kwargs)
+
+ hattrs = self.fields['height'].widget.attrs
+ hattrs.setdefault('type', 'number')
+ hattrs.setdefault('step', '1')
+ hattrs['min'] = '0'
+
self.helper = FormHelper()
self.helper.form_class = 'wger-form'
self.helper.layout = Layout(