Django 4.1.1 redirect is not working if request.method=='POST'

I have tried to implement redirect in django 4.1.1 views. Please find the following code.

redirect is working

def customer_registration(request):
    return redirect('customer_login')

redirect not working

def customer_registration(request):
    if request.method == 'POST':
       return redirect('customer_login')
    return render(request, 'registration/registration.html')

Can anyone help what is the problem, I have already gone through the internet none of the solutions working. Please help me.

====== ========

def HomeView(request):
    form = ProductForm()
    context = {
    return render(request,'index.html',context)

def customer_registration(request):
    print("-------- GET method called ----------")
    if request.method == 'POST':
      print("-------- POST method called ----------")
      return redirect('home')

===== =====

from django.urls import path
from .views import *
urlpatterns = [
    path('home/', HomeView,name='home'),
    path('', customer_registration,name='other'),

====== html code ========

{% block body %}
     <form action="{% url 'other' %}" method="post">
          {% csrf_token %}
          <p><button type="submit">Add</button></p>
{% endblock body %}

====== output after press Add button in terminal ========

-------- GET method called ----------
-------- POST method called ----------
Back to Top