Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

apps.py 1.2KB

1 year ago
123456789101112131415161718192021222324252627282930
  1. from django.apps import AppConfig
  2. from django.core import checks
  3. from django.db.models.query_utils import DeferredAttribute
  4. from django.db.models.signals import post_migrate
  5. from django.utils.translation import gettext_lazy as _
  6. from . import get_user_model
  7. from .checks import check_models_permissions, check_user_model
  8. from .management import create_permissions
  9. from .signals import user_logged_in
  10. class AuthConfig(AppConfig):
  11. default_auto_field = "django.db.models.AutoField"
  12. name = "django.contrib.auth"
  13. verbose_name = _("Authentication and Authorization")
  14. def ready(self):
  15. post_migrate.connect(
  16. create_permissions,
  17. dispatch_uid="django.contrib.auth.management.create_permissions",
  18. )
  19. last_login_field = getattr(get_user_model(), "last_login", None)
  20. # Register the handler only if UserModel.last_login is a field.
  21. if isinstance(last_login_field, DeferredAttribute):
  22. from .models import update_last_login
  23. user_logged_in.connect(update_last_login, dispatch_uid="update_last_login")
  24. checks.register(check_user_model, checks.Tags.models)
  25. checks.register(check_models_permissions, checks.Tags.models)