示例#1
0
文件: views.py 项目: frac/opentrials
def step_5(request, trial_pk):
    ct = get_object_or_404(ClinicalTrial, id=int(trial_pk))

    if request.POST:
        form = RecruitmentForm(request.POST, instance=ct,
                               display_language=request.user.get_profile().preferred_language)

        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('step_5',args=[trial_pk]))
    else:
        form = RecruitmentForm(instance=ct,
                               default_second_language=ct.submission.get_secondary_language(),
                               display_language=request.user.get_profile().preferred_language)

    forms = [form]
    return render_to_response('repository/trial_form.html',
                              {'forms':forms,
                               'trial_pk':trial_pk,
                               'title':TRIAL_FORMS[4],
                               'steps': step_list(trial_pk),
                               'remarks':Remark.opened.filter(submission=ct.submission,context=slugify(TRIAL_FORMS[4])),
                               'default_second_language': ct.submission.get_secondary_language(),
                               'available_languages': [lang.lower() for lang in ct.submission.get_mandatory_languages()],},
                               context_instance=RequestContext(request))
示例#2
0
def step_5(request, trial_pk):
    ct = get_object_or_404(ClinicalTrial, id=int(trial_pk))

    if request.POST:
        form = RecruitmentForm(request.POST, instance=ct)

        if form.is_valid():
            form.save()

            if request.POST.has_key('submit_next'):
                return HttpResponseRedirect(reverse("step_6",args=[trial_pk]))

            return HttpResponseRedirect(reverse("repository.edittrial", args=[trial_pk]))
    else:
        form = RecruitmentForm(instance=ct)

    forms = [form]
    return render_to_response('repository/trial_form.html',
                              {'forms':forms,
                               'username':request.user.username,
                               'trial_pk':trial_pk,
                               'title':TRIAL_FORMS[4],
                               'steps': step_list(trial_pk),
                               'next_form_title':_('Study Type Form')})