How can we change the default process of the update method for a queryset in django as it does not call save method for each object. And since I have overridden the save method, I need it to be called each time the object is changed.
I looked for django doc but this is just for get_query_set
, Is there is something similar for the update method also.
This worked for me
class MyQuerySet(models.query.QuerySet):
def update(self, *args, **kwargs):
# here queryset update method overridden
pass
class NewManager(models.Manager):
def get_queryset(self):
# this is to use your custom queryset methods
return MyQuerySet(self.model, using=self._db)
class MyModel(models.Model):
objects = NewManager()
myfield = models.SomeTypeOfField(**kwargs)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With