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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/50f7d408-d795-469d-99a1-35245318f260n%40googlegroups.com.

Reply via email to