Skip to content

Commit 95f824a

Browse files
authored
Update django.contrib.admin for Django 5.2 (#2607)
Signed-off-by: SaJH <wogur981208@gmail.com>
1 parent 0be73eb commit 95f824a

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

django-stubs/contrib/admin/models.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class LogEntryManager(models.Manager[LogEntry]):
2828
queryset: QuerySet[Model],
2929
action_flag: int,
3030
change_message: str | list[Any] = "",
31+
*,
32+
single_object: bool = False,
3133
) -> list[LogEntry] | LogEntry: ...
3234

3335
class LogEntry(models.Model):

django-stubs/contrib/admin/tests.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase):
2323
def deselect_option(self, selector: str, value: Any) -> None: ...
2424
def assertSelectOptions(self, selector: str, values: Any) -> None: ...
2525
def assertSelectedOptions(self, selector: str, values: Any) -> None: ...
26-
def has_css_class(self, selector: str, klass: str) -> bool: ...
26+
def is_disabled(self, selector: str) -> bool: ...

django-stubs/contrib/admin/utils.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def label_for_field(
9393
form: BaseForm | None = ...,
9494
) -> str: ...
9595
def help_text_for_field(name: str, model: type[Model]) -> str: ...
96-
def display_for_field(value: Any, field: Field, empty_value_display: str) -> str: ...
96+
def display_for_field(value: Any, field: Field, empty_value_display: str, avoid_link: bool = False) -> str: ...
9797
def display_for_value(value: Any, empty_value_display: str, boolean: bool = ...) -> str: ...
9898

9999
class NotRelationField(Exception): ...

django-stubs/contrib/admindocs/utils.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from collections.abc import Callable
2+
from re import Pattern
23
from typing import Any
34

45
from django.utils.safestring import SafeString
@@ -10,7 +11,9 @@ def parse_docstring(docstring: str) -> tuple[str, str, dict[str, str]]: ...
1011
def parse_rst(text: str, default_reference_context: Any, thing_being_parsed: Any | None = ...) -> SafeString: ...
1112

1213
ROLES: dict[str, str]
14+
explicit_title_re: Pattern[str]
1315

16+
def split_explicit_title(text: str) -> tuple[bool, str, str]: ...
1417
def create_reference_role(rolename: str, urlbase: str) -> None: ...
1518
def default_reference_role(
1619
name: str,
@@ -27,3 +30,4 @@ unnamed_group_matcher: Any
2730

2831
def replace_named_groups(pattern: str) -> str: ...
2932
def replace_unnamed_groups(pattern: str) -> str: ...
33+
def strip_p_tags(value: str) -> SafeString: ...

django-stubs/contrib/admindocs/views.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ from collections.abc import Callable, Iterable
22
from re import Pattern
33
from typing import Any
44

5+
from django.contrib.auth.models import AbstractBaseUser, AnonymousUser
56
from django.db.models.fields import Field
7+
from django.db.models.options import Options
68
from django.urls import _AnyURL
79
from django.views.generic import TemplateView
810

@@ -14,6 +16,9 @@ class TemplateTagIndexView(BaseAdminDocsView): ...
1416
class TemplateFilterIndexView(BaseAdminDocsView): ...
1517
class ViewIndexView(BaseAdminDocsView): ...
1618
class ViewDetailView(BaseAdminDocsView): ...
19+
20+
def user_has_model_view_permission(user: AbstractBaseUser | AnonymousUser, opts: Options) -> bool: ...
21+
1722
class ModelIndexView(BaseAdminDocsView): ...
1823
class ModelDetailView(BaseAdminDocsView): ...
1924
class TemplateDetailView(BaseAdminDocsView): ...

scripts/stubtest/allowlist_todo_django52.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
# Autogenerated by `stubtest`
22

33
# Created for 5.2 update:
4-
django.contrib.admin.models.LogEntryManager.log_actions
5-
django.contrib.admin.tests.AdminSeleniumTestCase.has_css_class
6-
django.contrib.admin.tests.AdminSeleniumTestCase.is_disabled
7-
django.contrib.admin.utils.display_for_field
8-
django.contrib.admindocs.utils.explicit_title_re
9-
django.contrib.admindocs.utils.split_explicit_title
10-
django.contrib.admindocs.utils.strip_p_tags
11-
django.contrib.admindocs.views.user_has_model_view_permission
124
django.contrib.auth.backends.RemoteUserBackend.aauthenticate
135
django.contrib.auth.backends.RemoteUserBackend.aconfigure_user
146
django.contrib.auth.base_user.BaseUserManager.aget_by_natural_key

0 commit comments

Comments
 (0)