diff --git a/.github/workflows/modoboa.yml b/.github/workflows/modoboa.yml index cacf20a0e..39d8be9ba 100644 --- a/.github/workflows/modoboa.yml +++ b/.github/workflows/modoboa.yml @@ -97,7 +97,7 @@ jobs: pip install -r mysql-requirements.txt echo "DB=mysql" >> $GITHUB_ENV - name: Test with pytest - if: ${{ matrix.python-version != '3.8' || matrix.database != 'postgres' }} + if: ${{ matrix.database != 'postgres' }} run: | python ./tests.py cd test_project diff --git a/modoboa/admin/models/domain.py b/modoboa/admin/models/domain.py index dd997b9a6..3cc25bf90 100644 --- a/modoboa/admin/models/domain.py +++ b/modoboa/admin/models/domain.py @@ -313,7 +313,8 @@ class Domain(mixins.MessageLimitMixin, AdminObject): def save(self, *args, **kwargs): """Store current data if domain is renamed.""" - if self.oldname != self.name: + # We check that the instance exists to use m2m relationship + if self.pk and self.oldname != self.name: self.old_mail_homes = { mb.id: mb.mail_home for mb in self.mailbox_set.all() }