mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-13 07:21:56 +08:00
Do not force django.contrib.* dependencies (#535)
* Do not force django.contrib.* dependencies Fixes #428. Fixes #534. * Add one more test with contenttypes installed, but auth not
This commit is contained in:
committed by
GitHub
parent
f3e0872d6e
commit
d9c851abce
@@ -8,6 +8,9 @@ from mypy_django_plugin.lib import helpers
|
||||
|
||||
|
||||
def set_auth_user_model_as_type_for_request_user(ctx: AttributeContext, django_context: DjangoContext) -> MypyType:
|
||||
if not django_context.apps_registry.is_installed("django.contrib.auth"):
|
||||
return ctx.default_attr_type
|
||||
|
||||
# Imported here because django isn't properly loaded yet when module is loaded
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
|
||||
Reference in New Issue
Block a user