Private
Public Access
1
0

added birth date & sex to user model

This commit is contained in:
Sander Roosendaal
2017-12-07 08:39:13 +01:00
parent 59a2efb7dc
commit 2f7fcf444b
3 changed files with 64 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ from django import forms
from django.forms import ModelForm
from django.dispatch import receiver
from django.forms.widgets import SplitDateTimeWidget
from django.forms.extras.widgets import SelectDateWidget
from django.forms.formsets import BaseFormSet
from datetimewidget.widgets import DateTimeWidget
from django.core.validators import validate_email
@@ -210,6 +211,12 @@ class Rower(models.Model):
('lwt','light-weight'),
)
sexcategories = (
('male','male'),
('female','female'),
('not specified','not specified'),
)
stravatypes = (
('Ride','Ride'),
('Kitesurf','Kitesurf'),
@@ -257,6 +264,11 @@ class Rower(models.Model):
max_length=30,
choices=weightcategories)
sex = models.CharField(default="not specified",
max_length=30,
choices=sexcategories)
birthdate = models.DateField(null=True,blank=True)
# Power Zone Data
ftp = models.IntegerField(default=226,verbose_name="Functional Threshold Power")
@@ -939,10 +951,17 @@ class RowerPowerZonesForm(ModelForm):
class AccountRowerForm(ModelForm):
class Meta:
model = Rower
fields = ['weightcategory','getemailnotifications',
fields = ['sex','birthdate','weightcategory','getemailnotifications',
'defaulttimezone','showfavoritechartnotes',
'defaultlandingpage']
widgets = {
'birthdate': SelectDateWidget(
years=range(
timezone.now().year-100,timezone.now().year-10)),
}
def clean_email(self):
email = self.cleaned_data.get('email')