Private
Public Access
1
0

form test changes

This commit is contained in:
Sander Roosendaal
2019-01-22 12:18:27 +01:00
parent 43c2eb9b43
commit 17f41eb1bc
3 changed files with 29 additions and 2 deletions

View File

@@ -1726,6 +1726,13 @@ class TrainingMicroCycleForm(ModelForm):
'enddate': AdminDateWidget() 'enddate': AdminDateWidget()
} }
regularsessiontypechoices = (
('session','Training Session'),
('challenge','Challenge'),
('test','Mandatory Test'),
('cycletarget','Total for a time period'),
('coursetest','OTW test over a course'),
)
# model for Planned Session (Workout, Challenge, Test) # model for Planned Session (Workout, Challenge, Test)
class PlannedSession(models.Model): class PlannedSession(models.Model):
@@ -1740,6 +1747,14 @@ class PlannedSession(models.Model):
('indoorrace','Indoor Virtual Race'), ('indoorrace','Indoor Virtual Race'),
) )
regularsessiontypechoices = (
('session','Training Session'),
('challenge','Challenge'),
('test','Mandatory Test'),
('cycletarget','Total for a time period'),
('coursetest','OTW test over a course'),
)
sessionmodechoices = ( sessionmodechoices = (
('distance','Distance'), ('distance','Distance'),
('time','Time'), ('time','Time'),
@@ -2012,6 +2027,7 @@ class PlannedSessionForm(ModelForm):
def __init__(self,*args,**kwargs): def __init__(self,*args,**kwargs):
super(PlannedSessionForm, self).__init__(*args, **kwargs) super(PlannedSessionForm, self).__init__(*args, **kwargs)
self.fields['course'].queryset = GeoCourse.objects.all().order_by("country","name") self.fields['course'].queryset = GeoCourse.objects.all().order_by("country","name")
self.fields['sessiontype'].choices = regularsessiontypechoices
def get_course_timezone(course): def get_course_timezone(course):
@@ -2293,6 +2309,13 @@ class VirtualRaceForm(ModelForm):
return cd return cd
class PlannedSessionFormSmall(ModelForm): class PlannedSessionFormSmall(ModelForm):
regularsessiontypechoices = (
('session','Training Session'),
('challenge','Challenge'),
('test','Mandatory Test'),
('cycletarget','Total for a time period'),
('coursetest','OTW test over a course'),
)
class Meta: class Meta:
model = PlannedSession model = PlannedSession
@@ -2321,7 +2344,11 @@ class PlannedSessionFormSmall(ModelForm):
'sessionvalue': forms.TextInput(attrs={'style':'width:5em', 'sessionvalue': forms.TextInput(attrs={'style':'width:5em',
'type':'number'}), 'type':'number'}),
'manager': forms.HiddenInput(), 'manager': forms.HiddenInput(),
} }
def __init__(self,*args,**kwargs):
super(PlannedSessionFormSmall, self).__init__(*args, **kwargs)
self.fields['sessiontype'].choices = regularsessiontypechoices
boattypes = mytypes.boattypes boattypes = mytypes.boattypes

Binary file not shown.

View File

@@ -2502,7 +2502,7 @@
</Trackpoint> </Trackpoint>
</Track> </Track>
</Lap> </Lap>
<Notes>&lt;Element 'Notes' at 0x13a97908&gt;</Notes> <Notes>&lt;Element 'Notes' at 0x14de02b0&gt;</Notes>
</Activity> </Activity>
</Activities> </Activities>
<Creator> <Creator>