def save()

in treeherder/perf/models.py [0:0]


    def save(self, *args, **kwargs):
        # validate that we set a status that makes sense for presence
        # or absence of a related summary
        if self.related_summary and self.status not in self.RELATIONAL_STATUS_IDS:
            raise ValidationError(
                "Related summary set but status not in '{}'!".format(
                    ", ".join(
                        [
                            STATUS[1]
                            for STATUS in self.STATUSES
                            if STATUS[0] in self.RELATIONAL_STATUS_IDS
                        ]
                    )
                )
            )
        if not self.related_summary and self.status not in self.UNRELATIONAL_STATUS_IDS:
            raise ValidationError(
                "Related summary not set but status not in '{}'!".format(
                    ", ".join(
                        [
                            STATUS[1]
                            for STATUS in self.STATUSES
                            if STATUS[0] in self.UNRELATIONAL_STATUS_IDS
                        ]
                    )
                )
            )

        super().save(*args, **kwargs)

        # check to see if we need to update the summary statuses

        # just forward the explicit database
        # so the summary properly updates there
        using = kwargs.get("using", None)
        self.summary.update_status(using=using)
        if self.related_summary:
            self.related_summary.update_status(using=using)