Multiple Button In Django: Accept And Reject

I am new to Django. I am working on a project where I want accept and reject button and whenever client click on the respective button that object will go into the accept or reject template. I have no idea how can I do this.

This is my .html file which is displaying all the objects and have a accept and reject button:

<div class="body table-responsive">
                        <form id="form" method="POST" action = "{% url 'admin_team_detail' %}">
                                    {% csrf_token %}
                            <table class="table table-hover">
                                        <th>S No.</th>
                                        <th>COMPANY NAME</th>
                                        <th>TEAM MEMBER</th>

                                        {%for team in object%}

                                        <th scope="row"> {{ forloop.counter }}</th>
                                        <td><center><input type="submit" value="accept" name="accept">
                                            <input type="submit" value="reject" name="reject"></center></td> 

                                    {% endfor %}


Here is

def admin_team_detail(request):
obj= Create_Team.objects.all()
if request.method == 'POST':
    if 'reject' in request.POST :
        Create_Team.status = 'reject'
        Create_Team.status = 'accept'
return render(request, "admin/team-details.html", {"object": obj})

This is rendering all the objects from database and displaying on the website.

I know that I have to make two templates for accept and reject but I don't know how it will take the objects that have a accept or reject response.

And I also want that if client click on the button then that response will be saved in the database.

And I also want to know that whether I have to add a field in my for status.



First your two buttons should send the desired value to your and one hidden input in order to pass the team id

<input type="submit" value="reject" name="status">
<input type="submit" value="accept" name="status">
<input type="hidden" name="id" value={{ }}>

Next, in your

def admin_team_detail(request):
    if request.method == 'POST':
    # First, you should retrieve the team instance you want to update
        team = Create_Team.objects.get(id=request.POST('id'))

        # Next, you update the status
        if request.POST.get('status'):
            team.status = request.POST.get('status')

Note: this example assumes your Team model has a status field in order to store the reject/accept value.

class Team(models.Model):
    # You existing fields...
    status = models.CharField(max_length=30)