Commit 7573e2e
authored
* Update `admin.sites._ViewType` bound to allow `StreamingHttpResponse`
From the [Django documentation](https://docs.djangoproject.com/en/5.0/ref/request-response/#streaminghttpresponse-objects):
> The `StreamingHttpResponse` is not a subclass of `HttpResponse` ...
Because of this, creating an admin view that returned a
`StreamingHttpResponse` was causing the following Mypy error:
```
testing/admin.py:14: error: Value of type variable "_ViewType" of "admin_view" of "AdminSite" cannot be "Callable[[HttpRequest], StreamingHttpResponse]" [type-var]
```
This updates the admin `_ViewType` type-var bound to allow a Callable
that can return a union of `HttpResponse | StreamingHttpResponse`.
After this update to the stubs file, the Mypy error is no longer
reproducible.
* Use `HttpResponseBase` common parent instead
1 parent 6442aee commit 7573e2e
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
0 commit comments