working submission
This commit is contained in:
@@ -124,7 +124,7 @@ class EmailForm(forms.Form):
|
||||
subject = forms.CharField(max_length=255)
|
||||
message = forms.CharField(widget=forms.Textarea())
|
||||
|
||||
|
||||
|
||||
|
||||
disqualificationreasons = (
|
||||
('noimage','No monitor screenshot or data evidence was included'),
|
||||
@@ -386,7 +386,7 @@ class UploadOptionsForm(forms.Form):
|
||||
makeprivate = forms.BooleanField(initial=False,required=False,
|
||||
label='Make Workout Private')
|
||||
|
||||
submitrace = forms.ModelChoiceField(queryset=VirtualRace.objects.all(),
|
||||
submitrace = forms.ChoiceField(
|
||||
label='Submit as challenge Result',
|
||||
required=False)
|
||||
|
||||
@@ -404,6 +404,7 @@ class UploadOptionsForm(forms.Form):
|
||||
r = Rower.objects.get(user=self.request.user)
|
||||
races = VirtualRace.objects.filter(
|
||||
registration_closure__gt=timezone.now())
|
||||
|
||||
registrations = IndoorVirtualRaceResult.objects.filter(
|
||||
race__in = races,
|
||||
userid = r.id)
|
||||
@@ -413,25 +414,27 @@ class UploadOptionsForm(forms.Form):
|
||||
userid = r.id,
|
||||
)
|
||||
|
||||
raceids = [r.race.id for r in registrations]
|
||||
raceids2 = [r.race.id for r in registrations2]
|
||||
choices1 = [(r.id,str(r)) for r in registrations]
|
||||
choices2 = [(r.id,str(r)) for r in registrations2]
|
||||
choices3 = [(0,'---')]
|
||||
|
||||
raceids = raceids+raceids2
|
||||
choices = choices3+choices1+choices2
|
||||
|
||||
races = VirtualRace.objects.filter(
|
||||
id__in=raceids
|
||||
)
|
||||
if int(raceid) in [r.id for r in races]:
|
||||
therace = VirtualRace.objects.get(id=raceid)
|
||||
if therace.sessiontype == 'race':
|
||||
registrations = VirtualRaceResult.objects.filter(race=therace,userid=r.id)
|
||||
else:
|
||||
registrations = IndoorVirtualRaceResult.objects.filter(race=therace,userid=r.id)
|
||||
|
||||
choices = [(r.id,str(r)) for r in registrations]
|
||||
choices = [(0,'---')]+choices
|
||||
|
||||
if races:
|
||||
self.fields['submitrace'].queryset = races
|
||||
self.fields['submitrace'].choices = choices
|
||||
else:
|
||||
del self.fields['submitrace']
|
||||
|
||||
if int(raceid) in raceids:
|
||||
self.fields['submitrace'].initial = VirtualRace.objects.get(id=raceid)
|
||||
|
||||
|
||||
|
||||
# The form to indicate additional actions to be performed immediately
|
||||
# after a successful upload. This version allows the Team manager to select
|
||||
|
||||
Reference in New Issue
Block a user