Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

issue/rework-settings-page

Rohan Karan9b89b2131fd7
diff --git a/wger/core/forms.py b/wger/core/forms.py
index 413ab2162..37c446429 100644
--- a/wger/core/forms.py
+++ b/wger/core/forms.py
@@ -14,6 +14,7 @@
#
# You should have received a copy of the GNU Affero General Public License
+from datetime import date
# Django
from django import forms
from django.contrib.auth.forms import (
@@ -77,6 +78,17 @@ class UserPreferencesForm(forms.ModelForm):
help_text=_("Used for password resets and, optionally, e-mail reminders."),
required=False
)
+ birthdate = forms.DateField(
+ label=_("Date of Birth"),
+ required=False,
+ widget=forms.DateInput(
+ attrs={
+ 'type': 'date',
+ "max": str(date.today().replace(year=date.today().year - 10)),
+ "min": str(date.today().replace(year=date.today().year - 100))
+ },
+ )
+ )
class Meta:
model = UserProfile
@@ -104,7 +116,9 @@ class UserPreferencesForm(forms.ModelForm):
Column('first_name', css_class='form-group col-6 mb-0'),
Column('last_name', css_class='form-group col-6 mb-0'),
css_class='form-row'
- ), HTML("<hr>")
+ ),
+ 'birthdate',
+ HTML("<hr>")
),
Fieldset(
_("Workout reminders"),
@@ -121,7 +135,6 @@ class UserPreferencesForm(forms.ModelForm):
"show_comments",
"show_english_ingredients",
"num_days_weight_reminder",
- "birthdate",
), ButtonHolder(Submit('submit', _("Save"), css_class='btn-success btn-block'))
)
diff --git a/wger/core/models/profile.py b/wger/core/models/profile.py
index 9c1b46315..3f985d9f8 100644
--- a/wger/core/models/profile.py
+++ b/wger/core/models/profile.py
@@ -191,7 +191,7 @@ by the US Department of Agriculture. It is extremely complete, with around
"""The user's age"""
birthdate = models.DateField(
- verbose_name=('Date of Birth'),
+ verbose_name=_('Date of Birth'),
blank=False,
null=True,
validators=[birthdate_validator],