Skip to content

ModelAdmin extra_context should be Dict[str, Any] #669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andreymal opened this issue Jul 14, 2021 · 2 comments
Open

ModelAdmin extra_context should be Dict[str, Any] #669

andreymal opened this issue Jul 14, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@andreymal
Copy link

Because it's passed into templates context (see Django code). I use overridden templates and pass some objects to them using extra_context.

extra_context: Optional[Dict[str, bool]] = ...,
) -> Any: ...
def autocomplete_view(self, request: HttpRequest) -> JsonResponse: ...
def add_view(self, request: HttpRequest, form_url: str = ..., extra_context: None = ...) -> HttpResponse: ...
def change_view(
self, request: HttpRequest, object_id: str, form_url: str = ..., extra_context: Optional[Dict[str, bool]] = ...
) -> HttpResponse: ...
def changelist_view(
self, request: HttpRequest, extra_context: Optional[Dict[str, str]] = ...
) -> TemplateResponse: ...
def get_deleted_objects(
self, objs: QuerySet, request: HttpRequest
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
def delete_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> Any: ...
def history_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> HttpResponse: ...

@andreymal andreymal added the bug Something isn't working label Jul 14, 2021
@sobolevn
Copy link
Member

@andreymal please, feel free to submit a PR.

@andreymal
Copy link
Author

Oh, there is an issue #355 which replaces Dict with Mapping

But Django does not allow any mapping other than dict, so I'm not sure I'm able to make a proper PR :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants