I'm trying to implement a mechanism were by only 1 one query will be made in the database after the query, a boolean field in the database will change its status from true to false. I don't know how to accomplish this.
The Model
class Code(models.Model):
    best_before = models.DateTimeField(auto_now=True)
    expiry_date = models.DateTimeField(auto_now=True)
    code = models.CharField(max_length=8, blank=True, unique=True)
    status = models.BooleanField(blank=True, default=False)
And I'm using a get request to query code field in the database.
View
def index(request):
    info = Code.objects.all()
    query = request.GET.get('q')
    print(query)
    if query:
        info = info.filter(code__exact=query)
    context = {
      'info':info,
      'query':query
     }
    return render(request, 'drugs/index.html', context)
 
     
    