I have models like Id, Name, email, Status. And created serializers and views.
I am updating the Status values by PUT method. How to implement an automatic email notification to smtp.example.com with the changed Status value.
Ex: Status column value is 'abc' I am updating value 'abc' to 'xyz' using PUT. I want an email should automatically send to particular email-id belongs to that row using primary key Id.
Django backend PUT method
if request.method=='GET':
employees = Employees.objects.all()
employees_serializer=EmployeeSerializer(employees,many=True)
return JsonResponse(employees_serializer.data,safe=False)
elif request.method=='POST':
employee_data=JSONParser().parse(request)
employees_serializer=EmployeeSerializer(data=employee_data)
if employees_serializer.is_valid():
employees_serializer.save()
I want to implement
```if(employee_data(after update !== employee_data(before update):
sendmail()
can some one help here with some proper logic and code.