Extending Choices for Questions in hrapplications to Allow Multiselect (#911)

An additional field at the question level defines whether the choices for the question are multi-select or not. The template will render the choices with radio buttons or checkboxes depending on multi-select. Multiple selected choices are saved with a line break between them.
This commit is contained in:
phaynu
2017-10-24 23:35:19 -05:00
committed by Adarnof
parent c63464c4c9
commit f961db3130
5 changed files with 25 additions and 4 deletions

View File

@@ -62,8 +62,8 @@ def hr_application_create_view(request, form_id=None):
application.save()
for question in app_form.questions.all():
response = ApplicationResponse(question=question, application=application)
response.answer = request.POST.get(str(question.pk),
"Failed to retrieve answer provided by applicant.")
response.answer = "\n".join(request.POST.getlist(str(question.pk),
""))
response.save()
logger.info("%s created %s" % (request.user, application))
return redirect('hrapplications:view')