Skip to content

Commit b699a15

Browse files
add django stubs for HistoricForeignKey
1 parent fd9aa52 commit b699a15

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

simple_history/models.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import uuid
44
import warnings
55
from functools import partial
6+
from typing import TypeVar
67

78
from django.apps import apps
89
from django.conf import settings
@@ -45,6 +46,13 @@
4546
except ImportError:
4647
from threading import local as LocalContext
4748

49+
50+
# __set__ value type
51+
_ST = TypeVar("_ST")
52+
# __get__ return type
53+
_GT = TypeVar("_GT")
54+
55+
4856
registered_models = {}
4957

5058

@@ -873,7 +881,7 @@ def get_queryset(self):
873881
)
874882

875883

876-
class HistoricForeignKey(ForeignKey):
884+
class HistoricForeignKey(ForeignKey[_ST, _GT]):
877885
"""
878886
Allows foreign keys to work properly from a historic instance.
879887

0 commit comments

Comments
 (0)