training = ModelChoiceField(label='Formation',
queryset=Training.objects.filter(available=True))
+
+ fascicule = forms.ChoiceField(choices=TRUE_FALSE_CHOICES,
+ label='Envoi postal des fascicules de cours',
+ required=False,
+ widget=forms.Select())
+
procedure = ModelChoiceField(label=_('Procedure'),
help_text="Matière de procédure",
queryset=Course.objects.filter(procedure=True))
choices=payment_schedule_choices,
required=True)
- fascicule = forms.ChoiceField(choices=TRUE_FALSE_CHOICES,
- label='Envoi postal des fascicules',
- required=False,
- widget=forms.Select())
-
# no model
captcha = ReCaptchaField()
accept = BooleanField()
self.fields['email'].required = True
self.user_fields = ['first_name', 'last_name', 'email', 'address', 'address_detail',
'postal_code', 'city', 'country', 'telephone', 'birthday', 'portrait']
- self.training_fields = ['level', 'iej', 'period', 'platform_only', 'fascicule',
- 'training', 'procedure', 'written_speciality', 'oral_1']
+ self.training_fields = ['level', 'iej', 'period', 'platform_only',
+ 'training', 'fascicule', 'procedure', 'written_speciality', 'oral_1']
def clean_portrait(self):
image = self.cleaned_data['portrait']
function updateFascicule() {
var platformOnly = $("[name='platform_only']").val() === 'True' ? true : false;
- if (platformOnly)
+ var training = $("[name='training'] option:selected").text();
+ var showFasc = training.indexOf("Séminaires de correction") === -1 && training.indexOf("----") === -1;
+
+ if (platformOnly && showFasc)
$("[name='fascicule']").parent().show();
else
$("[name='fascicule']").parent().hide();
$("#id_period, #id_platform_only").change(updateTrainings);
updateFascicule();
$("[name='platform_only']").change(updateFascicule);
+ $("[name='training']").change(updateFascicule);
});
</script>
<style>