mercredi 3 novembre 2021

Update only that property not all model, django

@property
def policy_escape(self):
    if self.date - datetime.date.today:
        self.status = 2
        self.save()

def save(self, *args, **kwargs):
   self.counter = counter + 1

I have this logic for policies. For every policy created I want to increase a property nnumber(this is not exact my case).

I want when policy date is today date to change the status of that policy. But when I change it, the policy counter is increasing.

Can someone help me to update only status without updating other properties?

Thanks in advance




Aucun commentaire:

Enregistrer un commentaire