diff --git a/apps/common/__init__.py b/apps/common/__init__.py index de85ce4b66..915dc928eb 100644 --- a/apps/common/__init__.py +++ b/apps/common/__init__.py @@ -10,7 +10,6 @@ from django.contrib.auth.models import User from django.contrib.auth.management import create_superuser from django.dispatch import receiver from django.db.models.signals import post_save -from django.db import transaction, DatabaseError from navigation.api import register_links, register_top_menu @@ -72,14 +71,10 @@ def create_superuser(sender, **kwargs): @receiver(post_save, dispatch_uid='auto_admin_account_passwd_change', sender=User) def auto_admin_account_passwd_change(sender, instance, **kwargs): - with transaction.commit_on_success(): - try: - auto_admin_properties = AutoAdminSingleton.objects.get() - if instance == auto_admin_properties.account and instance.password != auto_admin_properties.password_hash: - # Only delete the auto admin properties when the password has been changed - auto_admin_properties.delete(force=True) - except DatabaseError: - transaction.rollback() + auto_admin_properties = AutoAdminSingleton.objects.get() + if instance == auto_admin_properties.account and instance.password != auto_admin_properties.password_hash: + # Only delete the auto admin properties when the password has been changed + auto_admin_properties.delete(force=True) if (validate_path(TEMPORARY_DIRECTORY) == False) or (not TEMPORARY_DIRECTORY):