Hi,
I am new to Django rest framework. In my project I have written api view for phone OTP verification there If I use api_view(['POST']) method it is raised an error.
```
@api_view(['POST'])
@permission_classes([AllowAny])
@renderer_classes([TemplateHTMLRenderer, JSONRenderer])
def phone_otp_verify(request, id):
Qurycustomer = customer.objects.get(id=id)
OTP = Qurycustomer.phone_OTP
if request.method == 'POST':
security_1 = request.POST['security_1']
security_2 = request.POST['security_2']
security_3 = request.POST['security_3']
security_4 = request.POST['security_4']
security_5 = request.POST['security_5']
OTP_entered = str(security_1) + str(security_2) + str(security_3) + str(security_4) + str(security_5)
OTP_en = int(OTP_entered)
if OTP == OTP_en:
Qurycustomer.cust_status = 1
Qurycustomer.phone_verify = 1
Qurycustomer.phone_OTP = 00000
Qurycustomer.os_name = osname
Qurycustomer.browser = webname
Qurycustomer.ip_address = ip_address
Qurycustomer.history.change_by_reason = "Phone number verified"
Qurycustomer.save()
return redirect('/home')
return render(request, 'phone_otp_verify.html')
```
If I open this url(
http://127.0.0.1:8000/phone-otp-verify/17) I am getting error "405 Method Not Allowed" From above code If I mute "@api_view(['POST'])" this line of code I am not getting any error How can I achieve this Please help me out.