diff --git a/tests/typecheck/models/test_contrib_models.yml b/tests/typecheck/models/test_contrib_models.yml index 9aba18264c..ba1e79ab92 100644 --- a/tests/typecheck/models/test_contrib_models.yml +++ b/tests/typecheck/models/test_contrib_models.yml @@ -104,3 +104,29 @@ users = models.ManyToManyField(settings.AUTH_USER_MODEL) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) unq_user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + +- case: test_relate_to_auth_user_model_when_auth_not_installed + main: | + from other.models import Other + reveal_type(Other().user) + out: | + main:2: note: Revealed type is "myapp.models.MyUser" + custom_settings: | + INSTALLED_APPS = ('django.contrib.contenttypes', 'myapp', 'other') + AUTH_USER_MODEL='myapp.MyUser' + files: + - path: myapp/__init__.py + - path: myapp/models.py + content: | + from django.db import models + + class MyUser(models.Model): + ... + - path: other/__init__.py + - path: other/models.py + content: | + from django.conf import settings + from django.db import models + + class Other(models.Model): + user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)