Skip to content

Commit

Permalink
fixup! Resolve any settings.AUTH_USER_MODEL used as to in relation
Browse files Browse the repository at this point in the history
  • Loading branch information
flaeppe committed Sep 28, 2023
1 parent 9bf6dc5 commit c5b24aa
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/typecheck/models/test_contrib_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit c5b24aa

Please sign in to comment.