def METHOD_NAME(self, *args, **kwargs):
    if self._state.adding:
        smallest_sort_order = Module.objects.filter(
            project=self.project
        ).aggregate(smallest=models.Min("sort_order"))["smallest"]
        if smallest_sort_order is not None:
            self.sort_order = smallest_sort_order - 10000
    super(Module, self).METHOD_NAME(*args, **kwargs)