Skip to content

Commit

Permalink
added trigger email on cancellation (#36)
Browse files Browse the repository at this point in the history
* added trigger email on cancellation

* fixed it as request user

---------

Co-authored-by: Yasmeen Haleem <[email protected]>
  • Loading branch information
manushree08 and yasmeenha authored Dec 4, 2023
1 parent 9e88b05 commit 1e30faf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ def cancel_appointment(request):
# Update the AvailableSlot to mark it as available
available_slot.unavailable_flag = False
available_slot.save()
trigger_email(request.user.first_name, request.user.email,
f'Appointment Cancellation',
f'Your appointment has been successfully canceled.')
except Appointments.DoesNotExist or ValueError:
error_message = "Appointment not found. Please enter a valid appointment ID."

Expand All @@ -387,4 +390,4 @@ def view_schedule(request):
return render (request, 'view_schedule.html', {'appointments': appointments})
else:
form = DoctorAppointmentViewForm()
return render (request, 'view_schedule.html', {'form': form})
return render (request, 'view_schedule.html', {'form': form})

0 comments on commit 1e30faf

Please sign in to comment.