mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 04:54:48 +08:00
Split AddManagers for model in separate stages to process IncompleteDefnException properly (#171)
This commit is contained in:
@@ -571,4 +571,26 @@
|
||||
class Book(LibraryEntity):
|
||||
pass
|
||||
class Article(LibraryEntity):
|
||||
pass
|
||||
pass
|
||||
|
||||
|
||||
- case: foreign_key_relationship_for_models_with_custom_manager
|
||||
main: |
|
||||
from myapp.models import Transaction
|
||||
installed_apps:
|
||||
- myapp
|
||||
files:
|
||||
- path: myapp/__init__.py
|
||||
- path: myapp/models.py
|
||||
content: |
|
||||
from django.db import models
|
||||
class TransactionQuerySet(models.QuerySet):
|
||||
pass
|
||||
class Transaction(models.Model):
|
||||
objects = TransactionQuerySet.as_manager()
|
||||
def test(self) -> None:
|
||||
self.transactionlog_set
|
||||
class TransactionLog(models.Model):
|
||||
transaction = models.ForeignKey(Transaction, on_delete=models.CASCADE)
|
||||
|
||||
Transaction().test()
|
||||
Reference in New Issue
Block a user