Skip to content

Commit c5b24aa

Browse files
committed
fixup! Resolve any settings.AUTH_USER_MODEL used as to in relation
1 parent 9bf6dc5 commit c5b24aa

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/typecheck/models/test_contrib_models.yml

+26
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,29 @@
104104
users = models.ManyToManyField(settings.AUTH_USER_MODEL)
105105
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
106106
unq_user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
107+
108+
- case: test_relate_to_auth_user_model_when_auth_not_installed
109+
main: |
110+
from other.models import Other
111+
reveal_type(Other().user)
112+
out: |
113+
main:2: note: Revealed type is "myapp.models.MyUser"
114+
custom_settings: |
115+
INSTALLED_APPS = ('django.contrib.contenttypes', 'myapp', 'other')
116+
AUTH_USER_MODEL='myapp.MyUser'
117+
files:
118+
- path: myapp/__init__.py
119+
- path: myapp/models.py
120+
content: |
121+
from django.db import models
122+
123+
class MyUser(models.Model):
124+
...
125+
- path: other/__init__.py
126+
- path: other/models.py
127+
content: |
128+
from django.conf import settings
129+
from django.db import models
130+
131+
class Other(models.Model):
132+
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)

0 commit comments

Comments
 (0)