juntossomosmais / django-outbox-pattern

A django application to make it easier to use the transactional outbox pattern
MIT License
50 stars 7 forks source link

fix: fix override model save method #42

Open hugobrilhante opened 7 months ago

hugobrilhante commented 7 months ago

This PR aims to fix a, perhaps critical, issue, which was the overlap of the save method in the model. Without the correction, it is not possible to perform actions as shown in the example because the save method will never be executed.


@publish([
    Config(destination='/destination')
])
class Order(models.Model):

    id = models.AutoField(primary_key=True)

    def save(self, *args, **kwargs):
        logger.info("Override save method")
        super().save(*args, **kwargs)

    def __str__(self):
        return f"{self.id}"