Exemplo n.º 1
0
def delete_appointment(request, pk):
    appointment = get_object_or_404(Appointment, pk=pk)
    success = False
    if request.user.userprofile.customer != appointment.customer:
        return False
    if request.is_ajax() and request.method == 'POST':
        form = IDForm(request.POST)
        if form.is_valid() and form.cleaned_data['id'] == appointment.pk:
            appointment.delete()
            success = True
    return HttpResponse(json.dumps(success), content_type="application/json")
Exemplo n.º 2
0
def delete_appointment(request, pk):
    appointment = get_object_or_404(Appointment, pk=pk)
    success = False
    if request.user.userprofile.customer != appointment.customer:
        return False
    if request.is_ajax() and request.method == 'POST':
        form = IDForm(request.POST)
        if form.is_valid() and form.cleaned_data['id'] == appointment.pk:
            appointment.delete()
            success = True
    return HttpResponse(json.dumps(success), content_type="application/json")
Exemplo n.º 3
0
def edit_appointment_status(request, pk):
    appointment = get_object_or_404(Appointment, pk=pk)
    success = False
    if request.user.userprofile.customer != appointment.customer:
        return False
    if request.is_ajax() and request.method == 'POST':
        form = IDForm(request.POST)
        if form.is_valid() and form.cleaned_data['id'] == appointment.pk:
            if 'status' in request.POST and request.POST['status'] in Appointment.STATUS_LIST:
                appointment.status = request.POST['status']
                appointment.save()
                success = True
    return HttpResponse(json.dumps(success), content_type="application/json")
Exemplo n.º 4
0
def edit_appointment_status(request, pk):
    appointment = get_object_or_404(Appointment, pk=pk)
    success = False
    if request.user.userprofile.customer != appointment.customer:
        return False
    if request.is_ajax() and request.method == 'POST':
        form = IDForm(request.POST)
        if form.is_valid() and form.cleaned_data['id'] == appointment.pk:
            if 'status' in request.POST and request.POST[
                    'status'] in Appointment.STATUS_LIST:
                appointment.status = request.POST['status']
                appointment.save()
                success = True
    return HttpResponse(json.dumps(success), content_type="application/json")