예제 #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")
예제 #2
0
파일: ajax.py 프로젝트: Avatazjoe/apr
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")
예제 #3
0
파일: ajax.py 프로젝트: Avatazjoe/apr
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")
예제 #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")