00af109e2f
* add flake8 to pre-commit config, and fixup many things to make flake8 happy * add isort and sort all imports, add to pre-commit and requirements
26 lines
744 B
Python
26 lines
744 B
Python
import logging
|
|
|
|
from django.apps import AppConfig
|
|
from django.db.models.signals import post_save, pre_save
|
|
|
|
from .signal_handlers import create_profile, profile_pre_save
|
|
|
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
|
|
|
|
|
class ProfilesConfig(AppConfig):
|
|
name = "profiles"
|
|
|
|
def ready(self):
|
|
# remember to include a dispatch_uid to prevent signals being called multiple times in certain corner cases
|
|
from django.contrib.auth.models import User
|
|
|
|
post_save.connect(
|
|
create_profile, sender=User, dispatch_uid="user_post_save_signal"
|
|
)
|
|
pre_save.connect(
|
|
profile_pre_save,
|
|
sender="profiles.Profile",
|
|
dispatch_uid="profile_pre_save_signal",
|
|
)
|