I'm trying to keep track of the total hours being put into a work order. I'd like to add the new number being entered to the number existing in the DB and return the total.
Thank you in advance for any help.
The Model:
class WorkOrder(models.Model):
client = models.ForeignKey(Contact, on_delete=models.CASCADE)
hours_worked = models.IntegerField()
The View:
class UpdateWorkOrder(LoginRequiredMixin, generic.UpdateView):
model = WorkOrder
template_name = 'client/update_workorder.html'
success_url = reverse_lazy('dashboard')