mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-11 06:21:58 +08:00
Add datetime to DateTimeField (#675)
* Add datetime to set_type of DateTimeField `DateTimeField` was missing `datetime` as a valid set type. But Django clearly accepts `datetime`. * Fix test for DateTimeField type change datetime is now a valid set type for DateTimeField
This commit is contained in:
@@ -451,6 +451,7 @@ class TimeField(DateTimeCheckMixin, Field[_ST, _GT]):
|
|||||||
): ...
|
): ...
|
||||||
|
|
||||||
class DateTimeField(DateField[_ST, _GT]):
|
class DateTimeField(DateField[_ST, _GT]):
|
||||||
|
_pyi_private_set_type: Union[str, datetime, date, Combinable]
|
||||||
_pyi_private_get_type: datetime
|
_pyi_private_get_type: datetime
|
||||||
_pyi_lookup_exact_type: Union[str, datetime]
|
_pyi_lookup_exact_type: Union[str, datetime]
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@
|
|||||||
from myapp.models import Publisher, PublisherDatetime, Book
|
from myapp.models import Publisher, PublisherDatetime, Book
|
||||||
Book(publisher_id=1, publisher_dt_id=now)
|
Book(publisher_id=1, publisher_dt_id=now)
|
||||||
Book(publisher_id=[], publisher_dt_id=now) # E: Incompatible type for "publisher_id" of "Book" (got "List[Any]", expected "Union[Combinable, int, str, None]")
|
Book(publisher_id=[], publisher_dt_id=now) # E: Incompatible type for "publisher_id" of "Book" (got "List[Any]", expected "Union[Combinable, int, str, None]")
|
||||||
Book(publisher_id=1, publisher_dt_id=1) # E: Incompatible type for "publisher_dt_id" of "Book" (got "int", expected "Union[str, date, Combinable, None]")
|
Book(publisher_id=1, publisher_dt_id=1) # E: Incompatible type for "publisher_dt_id" of "Book" (got "int", expected "Union[str, datetime, date, Combinable, None]")
|
||||||
installed_apps:
|
installed_apps:
|
||||||
- myapp
|
- myapp
|
||||||
files:
|
files:
|
||||||
|
|||||||
Reference in New Issue
Block a user