I have a view when should update the model data as "Sent" after rendering to template. I want to exclude things that are already sent then update the value no (number) as sent then return the data to the template.
the problem is that if i use it as it is it seem to do all three liunes in one go and excludes the no as its been sent,, how can I update it as sent AFTER the data is returned.
def get(self, request, *args, **kwargs):
lab = request.GET.get('lab', None)
audit = models.SendAudit.objects.filter(no__exact=labno).exclude(status__contains='sent')
models.SendAudit.objects.select_related().filter(no__exact=labno).update(status='{Sent}')
return render(request, self.template_name2, {'audit': audit, 'no': no})