Private
Public Access
1
0

adding template edit functionality

This commit is contained in:
Sander Roosendaal
2020-02-01 15:25:52 +01:00
parent 170fb3c8b6
commit aca8f28457
8 changed files with 346 additions and 12 deletions

View File

@@ -2342,6 +2342,35 @@ class PlannedSessionForm(ModelForm):
self.fields['sessiontype'].choices = regularsessiontypechoices
class PlannedSessionTemplateForm(ModelForm):
class Meta:
model = PlannedSession
fields = [
'name',
'sessiontype',
'sessionmode',
'criterium',
'sessionvalue',
'sessionunit',
'course',
'comment',
]
dateTimeOptions = {
'format': 'yyyy-mm-dd',
'autoclose': True,
}
widgets = {
'comment': forms.Textarea,
}
def __init__(self,*args,**kwargs):
super(PlannedSessionTemplateForm, self).__init__(*args, **kwargs)
self.fields['course'].queryset = GeoCourse.objects.all().order_by("country","name")
self.fields['sessiontype'].choices = regularsessiontypechoices
def get_course_timezone(course):
polygons = GeoPolygon.objects.filter(course = course)
points = GeoPoint.objects.filter(polygon = polygons[0])