No compatibility with django.contrib.auth.apps.AuthConfig
afedosenko opened this issue · 4 comments
afedosenko commented
Problem
class AuthConfig(AppConfig):
name = 'django.contrib.auth'
verbose_name = _("Authentication and Authorization")
def ready(self):
post_migrate.connect(
create_permissions,
dispatch_uid="django.contrib.auth.management.create_permissions"
)
last_login_field = getattr(get_user_model(), 'last_login', None)
# Register the handler only if UserModel.last_login is a field.
if isinstance(last_login_field, DeferredAttribute):
from .models import update_last_login
user_logged_in.connect(update_last_login, dispatch_uid='update_last_login')
checks.register(check_user_model, checks.Tags.models)
checks.register(check_models_permissions, checks.Tags.models)
if isinstance(last_login_field, DeferredAttribute):
is negative
because type(last_login_field) = <class 'model_utils.tracker.DescriptorWrapper'>
Environment
- Django Model Utils version: 4.1.1
- Django version: 2.2.24
- Python version: 3.7.12
MRigal commented
Hi @afedosenko
Could you post your custom user model? There might be an issue over there
afedosenko commented
Hello @MRigal
from django.contrib.auth.models import AbstractUser
from model_utils import FieldTracker
class CustomUser(AbstractUser):
tracker = FieldTracker()
tumb1er commented
Using FieldTracker on custom user model has a long history of issues here on github, and it depends on Django's bugfix also.
I.e.:
https://code.djangoproject.com/ticket/30427#ticket
Looks like it's fixed in Django-4.0
daniel-butler commented
#514 This is a related issue