I can't make Search box

from django.shortcuts import render,redirect
from django.http import HttpResponse
from stockapp.forms import stockForm
from stockapp.models import Stock

from django.contrib import messages

Create your views here.

def index(request):
if request.method == ‘POST’:
search = request.POST.get(‘search’)
all_stock = Stock.objects.filter(devicename__icontains=search)
return render(request, ‘index.html’,{‘all_stock’: all_stock})
else :
all_stock = Stock.objects.all()
return render(request, ‘index.html’,{‘all_stock’: all_stock})

def create(request):
if request.method == ‘POST’:
form = stockForm(request.POST)
if form.is_valid():
form.save()
return redirect(‘/’)
else:
form = stockForm()
return render(request, ‘create.html’, {‘form’: form})

def delete(request, stk_id):
stock = Stock.objects.get(pk=stk_id)
stock.delete()
return redirect(‘/’)

def edit(request, stk_id):
if request.method == ‘POST’:
stock = Stock.objects.get(pk=stk_id)
form = stockForm(data=request.POST, instance=stock)
if form.is_valid():
form.save()
return redirect(‘/’)
else :
stock = Stock.objects.get(pk=stk_id)
form = stockForm(initial=stock.dict)
return render(request, ‘edit.html’, {‘form’: form,})

That view.py

{% block title %}
    {% endblock %}
    <link
        href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
        rel="stylesheet"
        integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
        crossorigin="anonymous" />
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container-fluid">
            <!-- <a class="navbar-brand" href="/">Stock</a> -->
            <button
                class="navbar-toggler"
                type="button"
                data-bs-toggle="collapse"
                data-bs-target="#navbarNav"
                aria-controls="navbarNav"
                aria-expanded="false"
                aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link me-2" aria-current="page" href="/">หน้าแรก</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link me-2" href="/create">เพิ่มอุปกรณ์</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link me-2" href="/admin">ผู้ดูแลระบบ</a>
                    </li>
                </ul>
            </div>
            <form method="POST" class="d-flex">
                {% csrf_token %}
                <div class="input-group">
                    <input
                        class="form-control me-2"
                        type="search"
                        placeholder="Search"
                        aria-label="Search"
                        required />
                </div>
                <button class="btn btn-outline-success" type="submit">Search</button>
            </form>
        </div>
    </nav>
    <div class="container my-2">
    {% block content %} 

    {% endblock %}
    </div>
</body>

That base.html

Your input element should have attribute name="search". With it, the search string will be sent along with the request.