def appointment_book_ajax_view(request): appointment = {} template = 'appointment/partials/confirmation_modal_content.html' dealer_factory = DealerShipServicesFactory() aptservice = dealer_factory.get_instance("appointment") if request.method == 'POST': aptservice = AppointmentService() #try: data = {} for key, value in request.POST.iteritems(): if key == "start_time": #value = datetime.datetime.strptime(value, '%b. %d, %Y, %I:%M %p') value = datetime.datetime.strptime(value, '%Y-%m-%d %H:%M') value = timezone.make_aware(value) data[key] = value aptservice = AppointmentService() context = aptservice.create_update_appointment(data) aptservice.book_appointment_with_id(request.POST.get('id'), request.session["dealer_id"]) appointment = aptservice.get_appointment_by_id(request.POST.get('id')) print appointment #except Exception, ex: #pass return render(request, template, appointment)
def appointment_row_ajax_view(request): template = 'mobilecheckin/appoinments/time_daily_row.html' context = {} if request.method == 'POST': aptservice = AppointmentService() context = {'row':aptservice.get_appointment_by_id(request.POST.get('id'))} print context return render(request, template, context)
def appointment_detail_ajax_view(request): template = 'mobilecheckin/appointments/detail.html' context = {} if request.method == 'POST': aptservice = AppointmentService() id = request.POST.get('id') print id row = aptservice.get_appointment_by_id(id) context = {"id": request.POST.get('id'), "row": row }#aptservice.get_appointment_by_id(request.POST.get('id')); return render(request, template, context)