from django.db.models.signals import post_save
from devilry.devilry_account.models import User
from django.conf import settings


def set_email_by_username(sender, **kwargs):
    """
    Signal handler which is invoked when a User is saved.
    """
    user = kwargs['instance']
    if not user.email:
        user.email = '{0}@{1}'.format(user.username, settings.DEVILRY_DEFAULT_EMAIL_SUFFIX)

post_save.connect(set_email_by_username,
                  sender=User)

from django.conf import settings


def set_email_by_username(sender, **kwargs):
    """
    Signal handler which is invoked when a User is saved.
    """
    user = kwargs['instance']
    if not user.email:
        user.email = '{0}@{1}'.format(user.username, settings.DEVILRY_DEFAULT_EMAIL_SUFFIX)

# post_save.connect(set_email_by_username,
#                   sender=User)

Comment out the post_save connect line.
devilry_autoset_empty_email_by_username: Comment out the post_save connect line.

- from django.db.models.signals import post_save
- from devilry.devilry_account.models import User
  from django.conf import settings
  
  
  def set_email_by_username(sender, **kwargs):
      """
      Signal handler which is invoked when a User is saved.
      """
      user = kwargs['instance']
      if not user.email:
          user.email = '{0}@{1}'.format(user.username, settings.DEVILRY_DEFAULT_EMAIL_SUFFIX)
  
- post_save.connect(set_email_by_username,
+ # post_save.connect(set_email_by_username,
-                   sender=User)
+ #                   sender=User)
  
Comment out the post_save connect line.
## Code Before:
from django.db.models.signals import post_save
from devilry.devilry_account.models import User
from django.conf import settings


def set_email_by_username(sender, **kwargs):
    """
    Signal handler which is invoked when a User is saved.
    """
    user = kwargs['instance']
    if not user.email:
        user.email = '{0}@{1}'.format(user.username, settings.DEVILRY_DEFAULT_EMAIL_SUFFIX)

post_save.connect(set_email_by_username,
                  sender=User)

## Instruction:
Comment out the post_save connect line.
## Code After:
from django.conf import settings


def set_email_by_username(sender, **kwargs):
    """
    Signal handler which is invoked when a User is saved.
    """
    user = kwargs['instance']
    if not user.email:
        user.email = '{0}@{1}'.format(user.username, settings.DEVILRY_DEFAULT_EMAIL_SUFFIX)

# post_save.connect(set_email_by_username,
#                   sender=User)
