def checklist_init(): flash_message = '' flash_category = '' form = make_checklist_init_form(g.event) if form.validate_on_submit(): flash_category = 'info' flash_message = _('Checklists are being created for the Event, Form, ' 'Role and Location Type you selected') channel = session.get('_id') task_kwargs = { 'event_id': form.data['event'], 'form_id': form.data['form'], 'role_id': form.data['role'], 'location_type_id': form.data['location_type'], 'channel': channel } init_submissions.apply_async(kwargs=task_kwargs) else: flash_category = 'danger' flash_message = _('Checklists were not created') flash(str(flash_message), flash_category) return redirect(url_for('formsview.index'))
def forms_list(view): template_name = 'admin/form_list.html' breadcrumbs = [_('Forms')] checklist_init_form = make_checklist_init_form(g.event) form_import_form = FormImportForm() context = { 'forms': models.Form.query.order_by('name').all(), 'checklist_forms': models.Form.query.filter( models.Form.form_type == 'CHECKLIST').order_by('name').all(), 'survey_forms': models.Form.query.filter( models.Form.form_type == 'SURVEY').order_by('name').all(), 'events': models.Event.query.order_by('name').all(), 'roles': models.ParticipantRole.query.order_by('name').all(), 'location_types': models.LocationType.query.all(), 'breadcrumbs': breadcrumbs, 'init_form': checklist_init_form, 'form_import_form': form_import_form, } return view.render(template_name, **context)
def checklist_init(): flash_message = '' flash_category = '' form = make_checklist_init_form() try: str_func = unicode except NameError: str_func = str if form.validate_on_submit(): flash_category = 'checklist_init_success' flash_message = _( 'Checklists are being created for the form, role and location type you selected in the current event' ) init_submissions.delay(str(g.deployment.pk), str(g.event.pk), form.data['form'], form.data['role'], form.data['location_type']) else: flash_category = 'checklist_init_failure' flash_message = _('Checklists were not created') flash(str_func(flash_message), flash_category) return redirect(url_for('.list_forms'))
def checklist_init(): flash_message = '' flash_category = '' form = make_checklist_init_form() try: str_func = unicode except NameError: str_func = str if form.validate_on_submit(): flash_category = 'checklist_init_success' flash_message = _('Checklists are being created for the form, role and location type you selected in the current event') init_submissions.delay( str(g.deployment.pk), str(g.event.pk), form.data['form'], form.data['role'], form.data['location_type']) else: flash_category = 'checklist_init_failure' flash_message = _('Checklists were not created') flash(str_func(flash_message), flash_category) return redirect(url_for('.list_forms'))
def list_forms(): page_title = _('Forms') template_name = 'frontend/form_list.html' forms = services.forms.find() checklist_init_form = make_checklist_init_form() context = { 'forms': forms, 'page_title': page_title, 'init_form': checklist_init_form } return render_template(template_name, **context)