bornhack-website/src/profiles/apps.py
Thomas Steen Rasmussen 00af109e2f
add flake8 and isort to pre-commit config, make flake8 and isort happy (#441)
* 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
2020-02-12 13:10:41 +01:00

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",
)