Пример #1
0
def register_complementary_insurance(request):
    if not request.method == "POST":
        raise Http404()
    form = ComplementaryInsuranceForm(request.POST)
    if form.is_valid():
        cd = form.cleaned_data
        cd['account_id'] = accounting.create_account(ComplementaryInsurance.ACCOUNT_SERIES)
        complementary_insurance = ComplementaryInsurance.objects.create(**cd)
        return render(request, 'json/complementary_insurance.json', {
            'complementary_insurance': complementary_insurance,
        })
Пример #2
0
def register_patient(request):
    if not request.method == "POST":
        raise Http404()
    form = PatientForm(request.POST)
    if form.is_valid():
        cd = form.cleaned_data
        cd['account_id'] = accounting.create_account(Patient.ACCOUNT_SERIES)
        patient = Patient.objects.create(**cd)
        return render(request, 'json/patient.json', {
            'patient': patient,
        })
    return render(request, 'json/error.json', {
        'errors': form.errors,
    })