[Answer]-DJANGO Update field of all objects in a table on save

1👍

How about calling update, which just updates the fields, and does not call the save.

def save(self, *args, **kwargs):

    Email.objects.filter(content_type__pk=self.content_type.id, object_id=self.object_id, main=True).update(main=False)

    self.main = True
    super(Email, self).save(*args, **kwargs)

Here is the documentation on update

Leave a comment