title: How to add Boolean Button for a django model BooleanField so that a normal user can set the value as true or false?
body: <p>I am making a Task Management To Do web app..My code is working upto the level that a user can add task after logging in and the task alongwith the foreign key user gets stores to UserTask Model which contain 4 fields including User(F.K.),Label,Due Date,Status(Boolean). The last three field are entered while adding a task by the user however I need my status field (which gets displayed in the task.html alongwith other fields)  such that it can be toggled between true or false (task completed or not) as a checkList preferably.</p>
  
  <p>How can i do that in django 3?</p>
  
  <p>My models.py,forms.py,views.py and tasks.html are as follows:</p>
  
  <p>models.py</p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  from django.conf import settings
  # Create your models here.
  
  class UserCustom(models.Model):
      user=models.OneToOneField(User,on_delete=models.CASCADE)
  
      profile_pic=models.ImageField(upload_to='profile_pics',blank=True)
  
      def __str__(self):
          return self.user.username   #user os object defined above
  
  class UserTask(models.Model):
      author = models.ForeignKey(User,on_delete=models.CASCADE)
      label=models.CharField(max_length=264)
      date=models.DateField()
      status=models.BooleanField(default=False)
  
      def __str__(self):
          return str(self.label)
  </code></pre>
  
  <p>forms.py</p>
  
  <pre><code>from django import forms
  from django.forms.fields import DateField
  from django.contrib.auth.models import User
  from taskApp.models import UserCustom,UserTask
  from django.contrib.admin.widgets import AdminDateWidget
  
  class UserForm(forms.ModelForm):
      password=forms.CharField(widget=forms.PasswordInput())
  
      class Meta():
          model=User
          fields=('username','email','password')
  
  class UserCustomForm(forms.ModelForm):
      class Meta():
          model=UserCustom
          fields=('profile_pic',)
  
  class UserTaskForm(forms.ModelForm):
      date=DateField(widget=forms.DateInput(attrs={'placeholder': 'YYYY-MM-DD', 'required': 'required'}))
      class Meta():
          model=UserTask
          fields=('label','date','status')
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>from django.shortcuts import render
  from taskApp.forms import UserForm,UserCustomForm,UserTaskForm
  from taskApp.models import UserCustom,UserTask
  #below libraries required for login
  from django.contrib.auth import authenticate,login,logout
  from django.http import HttpResponseRedirect,HttpResponse
  from django.urls import reverse
  from django.contrib.auth.decorators import login_required
  
  # Create your views here.
  def index(request):
      return render(request,'taskApp/index.html')
  
  @login_required
  def add_task(request):
      added=False
  
      if request.method == "POST":
          task_form=UserTaskForm(data=request.POST)
  
          if task_form.is_valid():
              task=task_form.save(commit=False)
              #print("NAME:"+str(request.user))
              task.author=request.user
              task.save()
              added=True
  
          else:
              print(task_form.errors)
  
  
      else: #no request=POST yet
          task_form=UserTaskForm()
  
      return render(request,'taskApp/addTask.html',{'added':added,'task_form':task_form})
  
  @login_required
  def my_task(request):
      task_obj=UserTask.objects.filter(author=request.user)
      return render(request,'taskApp/task.html',{'task_obj':task_obj})
  
  
  @login_required
  def user_logout(request):  #only login users can logout
      logout(request)
      return HttpResponseRedirect(reverse('index'))
  
  
  def register(request):
  
      registered=False
  
      if request.method == "POST":
  
          user_form=UserCustomForm(data=request.POST)
          profile_form=UserProfileInfoForm(data=request.POST)
  
          if user_form.is_valid() and profile_form.is_valid():
              user=user_form.save()
              user.set_password(user.password)
              user.save()
  
              profile=profile_form.save(commit=False)
              profile.user=user
  
              if 'profile_pic' in request.FILES:
                  profile.profile_pic=request.FILES['profile_pic']
  
              profile.save()
              registered=True
  
          else:
              print(user_form.errors,profile_form.errors)
  
      else: #no request=POST yet
          user_form=UserCustomForm()
          profile_form=UserProfileInfoForm()
  
      return render(request,'taskApp/registration.html',{'user_form':user_form,'profile_form':profile_form,'registered':registered })
  
  
  
  def user_login(request):
  
      if request.method=='POST':
          username=request.POST.get('username')  #name of element
          password=request.POST.get('password')
  
          user=authenticate(username=username,password=password)
  
          if user:
              if user.is_active:
                  login(request,user)
                  return HttpResponseRedirect(reverse('taskApp:myTask')) #myTask is the name of url , go to urls.py
              else:
                  return HttpResponse("ACCOUNT NOT ACTIVE")
  
          else:
              print("Someone tried to login and failed!")
              print("Username: {} and password {}".format(username,password))
              return HttpResponse("invalid login details supllied!")
  
      else:
          return render(request,'taskApp/login.html',{})
  </code></pre>
  
  <p>task.html</p>
  
  <pre><code>{% extends "taskApp/base.html" %}
  {% load static %}
  {% block body_block %}
  &lt;div class="jumbotron"&gt;
    {% if task_obj %}
        &lt;table&gt;
            &lt;thead&gt;
                &lt;th&gt;Label&lt;/th&gt;
                &lt;th&gt;Due Date&lt;/th&gt;
                &lt;th&gt;Status&lt;/th&gt;
            &lt;/thead&gt;
            {% for t in task_obj %}
              &lt;tr&gt;
                  &lt;td&gt;{{ t.label }}&lt;/td&gt;
                  &lt;td&gt;{{ t.date }}&lt;/td&gt;
                  &lt;td&gt;{{ t.status }}&lt;/td&gt;
              &lt;/tr&gt;
            {% endfor %}
        &lt;/table&gt;
    {% else %}
        &lt;p&gt;NO TASKS FOUND&lt;/p&gt;
    {% endif %}
  
  &lt;/div&gt;
  
  {% endblock %}
  </code></pre>