mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-01-24 12:01:53 +08:00
more values(), values_list() cases
This commit is contained in:
@@ -412,3 +412,25 @@
|
||||
related_name='+')
|
||||
publisher2 = models.ForeignKey(to=Publisher, on_delete=models.CASCADE,
|
||||
related_name='books2')
|
||||
|
||||
- case: to_parameter_could_be_resolved_if_passed_from_settings
|
||||
main: |
|
||||
from myapp.models import Book
|
||||
book = Book()
|
||||
reveal_type(book.publisher) # N: Revealed type is 'myapp.models.Publisher*'
|
||||
installed_apps:
|
||||
- myapp
|
||||
additional_settings:
|
||||
- BOOK_RELATED_MODEL='myapp.Publisher'
|
||||
files:
|
||||
- path: myapp/__init__.py
|
||||
- path: myapp/models.py
|
||||
content: |
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
|
||||
class Publisher(models.Model):
|
||||
pass
|
||||
class Book(models.Model):
|
||||
publisher = models.ForeignKey(to=settings.BOOK_RELATED_MODEL, on_delete=models.CASCADE,
|
||||
related_name='books')
|
||||
|
||||
Reference in New Issue
Block a user