Hello Please Help Me. I cannot change my company

here is my view please help me

# VIEWING THE TABLE
def display_companies (request):
    items = Paginator(Companies.objects.all(),10)
    page = request.GET.get('page')
    items = items.get_page(page)
    nums = "a" * items.paginator.num_pages
    context = {
        'items' : items,
        'header' : 'Tashkilotlarni',
        'nums' : nums
        }
    return render (request, 'home.html', context)
# CHANGING THE COMPANY
def change_company(request,pk):
    item = get_object_or_404(Companies, pk=pk)
    form = CompaniesForm(instance=item)

    if request.method == "POST":
        form = CompaniesForm(request.POST, instance=item)
        if form.is_valid():
            form.save()
            return redirect('display_companies')
    return render(request, 'change_company.html', {'form':form})

HERE IS MY HTML DOCUMENT

{% extends 'base.html' %}
{% block content %}
<div class="container">

    <form method="POST">
        {% csrf_token %}

        {% for field in form %}
        <div class="form-group row">
            <label for="id_{{field.STIR}}" class="col-2 col-form-label">{{ field.label }}</label>
            <div class="col-10">
                {{ field }}
            </div>
        </div>

        {% endfor %}
        <button type="submit" class="btn btn-outline-primary" name="button">O'zgartirish</button>
    </form>
</div>

{% endblock %}

i click on change company button but nothing changes it renders me to my form not to my home.html page PLEASE HELP ME GUYS. TY VERY MUCH.

Back to Top