Private
Public Access
1
0

forms & statements

This commit is contained in:
Sander Roosendaal
2020-05-31 21:28:46 +02:00
parent e418b04a9a
commit 04109773a8
2 changed files with 30 additions and 29 deletions

View File

@@ -213,17 +213,17 @@ class CourseForm(forms.Form):
super(CourseForm, self).__init__(*args, **kwargs)
# The form used for uploading files
#class StandardsForm(forms.Form):
# name = forms.CharField(max_length=150,label='Course Name')
# file = forms.FileField(required=False,
# validators=[must_be_csv])
# notes = forms.CharField(required=False,
# max_length=200,label='Course Notes',
# widget=forms.Textarea)
class StandardsForm(forms.Form):
name = forms.CharField(max_length=150,label='Course Name')
file = forms.FileField(required=False,
validators=[must_be_csv])
notes = forms.CharField(required=False,
max_length=200,label='Course Notes',
widget=forms.Textarea)
# def __init__(self, *args, **kwargs):
# from django.forms.widgets import HiddenInput
# super(StandardsForm, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs):
from django.forms.widgets import HiddenInput
super(StandardsForm, self).__init__(*args, **kwargs)
# The form used for uploading files
class DocumentsForm(forms.Form):
@@ -1230,11 +1230,11 @@ class RaceResultFilterForm(forms.Form):
initial=['None','PR1','PR2','PR3','FES'],
widget=forms.CheckboxSelectMultiple())
# entrycategory = forms.MultipleChoiceField(
# choices = [],
# label = 'Groups',
# widget=forms.CheckboxSelectMultiple()
# )
entrycategory = forms.MultipleChoiceField(
choices = [],
label = 'Groups',
widget=forms.CheckboxSelectMultiple()
)
def __init__(self, *args, **kwargs):
if 'records' in kwargs:
@@ -1244,18 +1244,19 @@ class RaceResultFilterForm(forms.Form):
if records:
# group
# thecategories = [record.entrycategory for record in records]
# thecategories = list(set(thecategories))
# if len(thecategories) <= 1:
# del self.fields['entrycategory']
# else:
# categorychoices = []
# for category in thecategories:
## categorychoices.append(
# (category.id,category)
# )
# self.fields['entrycategory'].choices = categorychoices
# self.fields['entrycategory'].initial = [cat[0] for cat in categorychoices]
thecategories = [record.entrycategory for record in records]
thecategories = list(set(thecategories))
if len(thecategories) <= 1:
del self.fields['entrycategory']
else:
categorychoices = []
for category in thecategories:
if category is not None:
categorychoices.append(
(category.id,category)
)
self.fields['entrycategory'].choices = categorychoices
self.fields['entrycategory'].initial = [cat[0] for cat in categorychoices]
# sex
thesexes = [record.sex for record in records]

View File

@@ -94,7 +94,7 @@ from rowers.forms import (
EmailForm, RegistrationForm, RegistrationFormTermsOfService,
RegistrationFormUniqueEmail,RegistrationFormSex,
CNsummaryForm,UpdateWindForm,
# StandardsForm,
StandardsForm,
UpdateStreamForm,WorkoutMultipleCompareForm,ChartParamChoiceForm,
FusionMetricChoiceForm,BoxPlotChoiceForm,MultiFlexChoiceForm,
TrendFlexModalForm,WorkoutSplitForm,WorkoutJoinParamForm,
@@ -115,7 +115,7 @@ from rowers.models import (
AlertEditForm, ConditionEditForm,
PlannedSessionComment,CoachRequest,CoachOffer,
VideoAnalysis,ShareKey,
# StandardCollection,CourseStandard,
StandardCollection,CourseStandard,
)
from rowers.models import (
RowerPowerForm,RowerForm,GraphImage,AdvancedWorkoutForm,