added birth date & sex to user model
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user