django-cms / django-filer

File and Image Management Application for django
https://django-filer.readthedocs.io/
Other
1.75k stars 577 forks source link

Projects with custom AUTH_USER_MODEL are broken in version 3.2 #1495

Open payamnj opened 2 weeks ago

payamnj commented 2 weeks ago

For type hinting the user parameter in the filer/cache.py functions, a new change added to get the user model. https://github.com/django-cms/django-filer/blob/44255c8a15f8973f34420aa0c9c869e281d9d45e/filer/cache.py#L7

Since this code can be executed before the django app is fully initialized (for example if we import FilerFileField in our application model) it will not be able to load the custome auth user model.

django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'my_app.User' that has not been installed

Maybe we can just use TypeVar here for type hinting the user parameters instead!

fsbraun commented 2 weeks ago

@payamnj Thanks, for reporting this! Good catch.

fsbraun commented 2 weeks ago

@payamnj Can you create a PR?

payamnj commented 2 weeks ago

@fsbraun Yes, I will create a PR for this.