title: How to change a model via a button?
body: <p>I am trying to make a function on my website which allows a user to delete their listings. What I want to happen is for them to click on a button which says "delete listing", this is then followed up by a new page which asks them to "Confirm" they want to delete their listing. Once this button is clicked they should be re-directed to to the index page. I am having some problems with this as when they confirm they want to delete their listing it is not suppose to actually delete the listing it just changes a field in the listing to 'False'. All my current attempts have failed, how can I change a field in a model when somebody clicks a button? My best idea was to have the button link to another page which then changes the model however I thought this seemed like an inefficient way to do this.
  Cheers</p>
  
  <p>View -</p>
  
  <pre><code>@login_required(redirect_field_name='login')
  def deletelistingconfirm(request, pk):
  
      post = JobListing.objects.get(pk=pk)
      print(post)
  
      if str(request.user) != str(post.user):
          return redirect("index")
  
      context_dict = {}
  
      return render(request, 'delete_listing_confirm.html', context_dict)
  </code></pre>