training = ModelChoiceField(label='Formation',
queryset=Training.objects.filter(available=True))
courses = ModelChoiceField(label='Matières',
- queryset=Course.objects.filter(id__in=settings.TELEFORMA_REGISTER_COURSE_CHOICE))
+ queryset=Course.objects.filter(id__in=settings.TELEFORMA_REGISTER_COURSE_CHOICE),
+ required=False)
training_adaptability = forms.ChoiceField(choices=TRUE_FALSE_CHOICES,
label="Avez-vous besoin d'adaptabilité de formation ?",
required=False,
widget=forms.Select())
-
- promo_code = CharField(label=_('Code promo'), max_length=100, required=False)
payment_schedule = ChoiceField(label=_(u'Échéancier de paiement'),
choices=payment_schedule_choices,
subscription_fees = training.cost
student = Student(user=user,
platform_only=platform_only,
- promo_code=data.get('promo_code'),
payment_schedule=data.get('payment_schedule'),
training_adaptability=data.get('training_adaptability') == 'True',
disability=data.get('disability') == 'True',
subscription_fees=subscription_fees
)
student.save()
- student.courses.add(data.get('courses'))
+ if data.get('courses'):
+ student.courses.add(data.get('courses'))
for course in Course.objects.filter(id__in=settings.TELEFORMA_REGISTER_COURSE_AUTOREGISTER):
student.courses.add(course)
student.trainings.add(data.get('training'))
<td>{% if student.disability %}Oui{% else %}Non{% endif %}</td>
</tr>
+ {% if not is_ae %}
<tr>
<td class="bold">{% trans "Studying level" %} : </td>
<td>{{ student.level }}</td>
<td class="bold">{% trans "IEJ" %} : </td>
<td>{{ student.iej.name }}</td>
</tr>
+ {% endif %}
<tr>
<td class="bold">{% trans "Training" %} : </td>
<td>{{ student.training.name }}</td>
<td class="bold">{% trans "Registration date" %} : </td>
<td>{{ student.date_registered}}</td>
</tr>
+ {% if not is_ae %}
<tr>
<td class="bold">{% trans "PROMO code" %} : </td>
<td>{{ student.promo_code}}</td>
</tr>
+ {% endif %}
</table>
import datetime
import xlrd
+from django.conf import settings
from django.contrib.auth import get_backends, login
from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.auth.models import User
profile.save()
context['student'] = student
+ context['is_ae'] = settings.TELEFORMA_E_LEARNING_TYPE == 'AE'
return context
class RegistrationPDFViewDownload(RegistrationPDFView):