Skip to content

Commit 58e3ffc

Browse files
committed
Merge branch 'master' into GeoModelAdminMixin
2 parents 0dac9c4 + b59a0fb commit 58e3ffc

File tree

17 files changed

+36
-148
lines changed

17 files changed

+36
-148
lines changed

django-stubs/conf/global_settings.pyi

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ TIME_ZONE: str
4040

4141
# If you set this to True, Django will use timezone-aware datetimes.
4242
USE_TZ: bool
43-
USE_DEPRECATED_PYTZ: bool
4443

4544
# Language code for this installation. All choices can be found here:
4645
# http://www.i18nguy.com/unicode/language-identifiers.html
@@ -66,10 +65,6 @@ LANGUAGE_COOKIE_HTTPONLY: bool
6665
LANGUAGE_COOKIE_SAMESITE: Literal["Lax", "Strict", "None", False] | None
6766
LANGUAGE_COOKIE_SECURE: bool
6867

69-
# If you set this to True, Django will format dates, numbers and calendars
70-
# according to user current locale.
71-
USE_L10N: bool
72-
7368
# Not-necessarily-technical managers of the site. They get broken link
7469
# notifications and other various emails.
7570
MANAGERS: _Admins

django-stubs/contrib/admin/options.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class BaseModelAdmin(Generic[_ModelT]):
128128
def get_prepopulated_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> dict[str, Sequence[str]]: ...
129129
def get_queryset(self, request: HttpRequest) -> QuerySet[_ModelT]: ...
130130
def get_sortable_by(self, request: HttpRequest) -> _DisplayT[_ModelT]: ...
131-
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
131+
def lookup_allowed(self, lookup: str, value: str, request: HttpRequest | None = ...) -> bool: ...
132132
def to_field_allowed(self, request: HttpRequest, to_field: str) -> bool: ...
133133
def has_add_permission(self, request: HttpRequest) -> bool: ...
134134
def has_change_permission(self, request: HttpRequest, obj: _ModelT | None = ...) -> bool: ...

django-stubs/contrib/gis/admin/__init__.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@ from django.contrib.admin import action as action
88
from django.contrib.admin import autodiscover as autodiscover
99
from django.contrib.admin import register as register
1010
from django.contrib.admin import site as site
11-
from django.contrib.gis.admin.options import GeoModelAdmin as GeoModelAdmin
1211
from django.contrib.gis.admin.options import GISModelAdmin as GISModelAdmin
13-
from django.contrib.gis.admin.options import OSMGeoAdmin as OSMGeoAdmin
1412
from django.contrib.gis.admin.widgets import OpenLayersWidget as OpenLayersWidget

django-stubs/contrib/gis/admin/options.pyi

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,11 @@ from django.contrib.admin import ModelAdmin
44
from django.contrib.gis.forms import OSMWidget
55
from django.db.models import Field
66
from django.forms.fields import Field as FormField
7-
from django.forms.widgets import Media
87
from django.http import HttpRequest
98

10-
spherical_mercator_srid: int
11-
129
class GeoModelAdminMixin:
1310
gis_widget: ClassVar[type[OSMWidget]]
1411
gis_widget_kwargs: ClassVar[dict[str, Any]]
1512
def formfield_for_dbfield(self, db_field: Field, request: HttpRequest, **kwargs: Any) -> FormField: ...
1613

1714
class GISModelAdmin(GeoModelAdminMixin, ModelAdmin): ...
18-
19-
class GeoModelAdmin(ModelAdmin):
20-
default_lon: int
21-
default_lat: int
22-
default_zoom: int
23-
display_wkt: bool
24-
display_srid: bool
25-
extra_js: Any
26-
num_zoom: int
27-
max_zoom: bool
28-
min_zoom: bool
29-
units: str | bool
30-
max_resolution: str | bool
31-
max_extent: str | bool
32-
modifiable: bool
33-
mouse_position: bool
34-
scale_text: bool
35-
layerswitcher: bool
36-
scrollable: bool
37-
map_width: int
38-
map_height: int
39-
map_srid: int
40-
map_template: str
41-
openlayers_url: str
42-
point_zoom: Any
43-
wms_url: str
44-
wms_layer: str
45-
wms_name: str
46-
wms_options: Any
47-
debug: bool
48-
widget: Any
49-
@property
50-
def media(self) -> Media: ...
51-
def get_map_widget(self, db_field: Any) -> Any: ...
52-
53-
class OSMGeoAdmin(GeoModelAdmin):
54-
map_template: str
55-
num_zoom: int
56-
map_srid: Any
57-
max_extent: str
58-
max_resolution: str
59-
point_zoom: int
60-
units: str

django-stubs/db/backends/base/base.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ _ExecuteWrapper: TypeAlias = Callable[
2424
[Callable[[str, Any, bool, dict[str, Any]], Any], str, Any, bool, dict[str, Any]], Any
2525
]
2626

27-
def timezone_constructor(tzname: str) -> tzinfo: ...
28-
2927
class BaseDatabaseWrapper:
3028
data_types: dict[str, str]
3129
data_types_suffix: dict[str, str]

django-stubs/db/models/constraints.pyi

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ from django.db.models.base import Model
77
from django.db.models.expressions import BaseExpression, Combinable
88
from django.db.models.query_utils import Q
99
from django.utils.functional import _StrOrPromise
10-
from typing_extensions import Self
10+
from typing_extensions import Self, deprecated
1111

1212
class Deferrable(Enum):
1313
DEFERRED: str
@@ -18,7 +18,19 @@ class BaseConstraint:
1818
violation_error_code: str | None
1919
violation_error_message: _StrOrPromise | None
2020
default_violation_error_message: _StrOrPromise
21-
def __init__(self, name: str, violation_error_message: _StrOrPromise | None = ...) -> None: ...
21+
@overload
22+
def __init__(
23+
self, *, name: str, violation_error_code: str | None = ..., violation_error_message: _StrOrPromise | None = ...
24+
) -> None: ...
25+
@overload
26+
@deprecated("Passing positional arguments to BaseConstraint is deprecated and will be removed in Django 6.0")
27+
def __init__(
28+
self,
29+
*args: Any,
30+
name: str | None = ...,
31+
violation_error_code: str | None = ...,
32+
violation_error_message: _StrOrPromise | None = ...,
33+
) -> None: ...
2234
def constraint_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ...
2335
def create_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ...
2436
def remove_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ...

django-stubs/templatetags/tz.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
from datetime import datetime
1+
from datetime import datetime, tzinfo
22
from typing import Any
33

44
from django.template import Node
55
from django.template.base import FilterExpression, NodeList, Parser, Token
6-
from django.utils.timezone import _TzInfoT
76

87
register: Any
98

109
class datetimeobject(datetime): ...
1110

1211
def localtime(value: datetime | str | None) -> Any: ...
1312
def utc(value: datetime | str | None) -> Any: ...
14-
def do_timezone(value: datetime | str | None, arg: _TzInfoT | str | None) -> Any: ...
13+
def do_timezone(value: datetime | str | None, arg: tzinfo | str | None) -> Any: ...
1514

1615
class LocalTimeNode(Node):
1716
nodelist: NodeList

django-stubs/test/runner.pyi

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ class DiscoverRunner:
144144
@contextmanager
145145
def load_with_patterns(self) -> Iterator[None]: ...
146146
def load_tests_for_label(self, label: str, discover_kwargs: dict[str, str]) -> TestSuite: ...
147-
def build_suite(
148-
self, test_labels: Sequence[str] = ..., extra_tests: list[Any] | None = ..., **kwargs: Any
149-
) -> TestSuite: ...
147+
def build_suite(self, test_labels: Sequence[str] | None = ..., **kwargs: Any) -> TestSuite: ...
150148
def setup_databases(self, **kwargs: Any) -> list[tuple[BaseDatabaseWrapper, str, bool]]: ...
151149
def get_resultclass(self) -> type[TextTestResult] | None: ...
152150
def get_test_runner_kwargs(self) -> dict[str, Any]: ...
@@ -157,7 +155,7 @@ class DiscoverRunner:
157155
def suite_result(self, suite: TestSuite, result: TextTestResult, **kwargs: Any) -> int: ...
158156
def _get_databases(self, suite: TestSuite) -> set[str]: ...
159157
def get_databases(self, suite: TestSuite) -> set[str]: ...
160-
def run_tests(self, test_labels: list[str], extra_tests: list[Any] | None = ..., **kwargs: Any) -> int: ...
158+
def run_tests(self, test_labels: list[str], **kwargs: Any) -> int: ...
161159

162160
def is_discoverable(label: str) -> bool: ...
163161
def reorder_suite(

django-stubs/utils/baseconv.pyi

Lines changed: 0 additions & 22 deletions
This file was deleted.

django-stubs/utils/dateformat.pyi

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
from datetime import date
1+
from datetime import date, tzinfo
22
from datetime import datetime as builtin_datetime
33
from datetime import time as builtin_time
44
from re import Pattern
55
from typing import Any, Literal
66

7-
from django.utils.timezone import _TzInfoT
8-
97
re_formatchars: Pattern[str]
108
re_escaped: Pattern[str]
119

@@ -14,7 +12,7 @@ class Formatter:
1412

1513
class TimeFormat(Formatter):
1614
data: builtin_datetime | builtin_time
17-
timezone: _TzInfoT | None
15+
timezone: tzinfo | None
1816
def __init__(self, obj: builtin_datetime | builtin_time) -> None: ...
1917
def a(self) -> str: ...
2018
def A(self) -> str: ...
@@ -34,7 +32,7 @@ class TimeFormat(Formatter):
3432

3533
class DateFormat(TimeFormat):
3634
data: builtin_datetime | date | builtin_time # type: ignore[assignment]
37-
timezone: _TzInfoT | None
35+
timezone: tzinfo | None
3836
year_days: Any
3937
def __init__(self, obj: builtin_datetime | builtin_time | date) -> None: ...
4038
def b(self) -> str: ...

0 commit comments

Comments
 (0)