def patient_reservations(request): response_data = {"patient": None} if request.method == 'POST': form = Patient_detail_form(request.POST) if form.is_valid(): hexdigest = get_hexdigest(form.cleaned_data["ident_hash"]) try: response_data["patient"] = Patient.objects.get(ident_hash=hexdigest) except Patient.DoesNotExist: pass return render_to_response("patient_reservations.html", response_data, context_instance=RequestContext(request))
def patient_reservations(request): response_data = {"patient": None} if request.method == 'POST': form = Patient_detail_form(request.POST) if form.is_valid(): hexdigest = get_hexdigest(form.cleaned_data["ident_hash"]) try: response_data["patient"] = Patient.objects.get( ident_hash=hexdigest) except Patient.DoesNotExist: pass return render_to_response("patient_reservations.html", response_data, context_instance=RequestContext(request))
def patient_details(request): response_data = { "first_name": "", "last_name": "", "phone_number": "", "email": "", } if request.method == 'POST': form = Patient_detail_form(request.POST) if form.is_valid(): hexdigest = get_hexdigest(form.cleaned_data["ident_hash"]) try: patient = Patient.objects.get(ident_hash=hexdigest) response_data = { "first_name": patient.first_name, "last_name": patient.last_name, "phone_number": patient.phone_number, "email": patient.email, } except Patient.DoesNotExist: pass return HttpResponse(json.dumps(response_data), "application/json")