Skip to content

Commit

Permalink
Fix signature of ModelAdmin.construct_change_message (#2444)
Browse files Browse the repository at this point in the history
* Fix signature of `ModelAdmin.construct_change_message`

The `form` argument was incorrectly typed.

* Fix annotations for `utils.construct_change_message`
  • Loading branch information
youtux authored Nov 17, 2024
1 parent ab4dcfa commit c4bb911
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions django-stubs/contrib/admin/options.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ from django.contrib.admin.filters import FieldListFilter, ListFilter
from django.contrib.admin.models import LogEntry
from django.contrib.admin.sites import AdminSite
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.forms import AdminPasswordChangeForm
from django.contrib.contenttypes.models import ContentType
from django.core.checks.messages import CheckMessage
from django.core.paginator import Paginator
Expand Down Expand Up @@ -225,7 +224,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
def _get_edited_object_pks(self, request: HttpRequest, prefix: str) -> list[str]: ...
def _get_list_editable_queryset(self, request: HttpRequest, prefix: str) -> QuerySet[_ModelT]: ...
def construct_change_message(
self, request: HttpRequest, form: AdminPasswordChangeForm, formsets: Iterable[BaseFormSet], add: bool = ...
self, request: HttpRequest, form: forms.Form, formsets: Iterable[BaseFormSet], add: bool = ...
) -> list[dict[str, dict[str, list[str]]]]: ...
def message_user(
self,
Expand Down
5 changes: 2 additions & 3 deletions django-stubs/contrib/admin/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ from uuid import UUID
from _typeshed import Unused
from django.contrib.admin.options import BaseModelAdmin
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.forms import AdminPasswordChangeForm
from django.db.models.base import Model
from django.db.models.deletion import Collector
from django.db.models.fields import Field, reverse_related
from django.db.models.options import Options
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
from django.forms.forms import BaseForm
from django.forms.forms import BaseForm, Form
from django.forms.formsets import BaseFormSet
from django.http.request import HttpRequest
from django.utils.datastructures import _IndexableCollection
Expand Down Expand Up @@ -100,5 +99,5 @@ def get_model_from_relation(field: Field | reverse_related.ForeignObjectRel) ->
def reverse_field_path(model: type[Model], path: str) -> tuple[type[Model], str]: ...
def get_fields_from_path(model: type[Model], path: str) -> list[Field]: ...
def construct_change_message(
form: AdminPasswordChangeForm, formsets: Iterable[BaseFormSet], add: bool
form: Form, formsets: Iterable[BaseFormSet], add: bool
) -> list[dict[str, dict[str, list[str]]]]: ...

0 comments on commit c4bb911

Please sign in to comment.