mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 20:24:31 +08:00
related_name is Optional[str] (#176)
In the current Django (2.1, 2.2), the `related_name` parameter to `OneToOneField` and `ForeignKey` classes (much like `ManyToManyField` and the base `ForeignObject` classes) is `Optional[str]`. While it's true that most authors won't pass `None` here, derived field types will want to be able to do so.
This commit is contained in:
committed by
Maxim Kurnikov
parent
c69090ec5b
commit
d3dca5b408
@@ -114,7 +114,7 @@ class ForeignKey(ForeignObject[_ST, _GT]):
|
|||||||
to: Union[Type[Model], str],
|
to: Union[Type[Model], str],
|
||||||
on_delete: Callable[..., None],
|
on_delete: Callable[..., None],
|
||||||
to_field: Optional[str] = ...,
|
to_field: Optional[str] = ...,
|
||||||
related_name: str = ...,
|
related_name: Optional[str] = ...,
|
||||||
related_query_name: Optional[str] = ...,
|
related_query_name: Optional[str] = ...,
|
||||||
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ...,
|
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ...,
|
||||||
parent_link: bool = ...,
|
parent_link: bool = ...,
|
||||||
@@ -159,7 +159,7 @@ class OneToOneField(RelatedField[_ST, _GT]):
|
|||||||
to: Union[Type[Model], str],
|
to: Union[Type[Model], str],
|
||||||
on_delete: Any,
|
on_delete: Any,
|
||||||
to_field: Optional[str] = ...,
|
to_field: Optional[str] = ...,
|
||||||
related_name: str = ...,
|
related_name: Optional[str] = ...,
|
||||||
related_query_name: Optional[str] = ...,
|
related_query_name: Optional[str] = ...,
|
||||||
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ...,
|
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ...,
|
||||||
parent_link: bool = ...,
|
parent_link: bool = ...,
|
||||||
|
|||||||
Reference in New Issue
Block a user