Skip to content

Commit

Permalink
Use generic response type
Browse files Browse the repository at this point in the history
  • Loading branch information
cjtapper committed Aug 31, 2022
1 parent c32fce4 commit cfe59fe
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/django_htmx/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import json
import sys
from typing import Any
from typing import Any, TypeVar

from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse
Expand Down Expand Up @@ -46,13 +46,16 @@ def __init__(self) -> None:
self["HX-Refresh"] = "true"


_R = TypeVar("_R", bound=HttpResponseBase)


def trigger_client_event(
response: HttpResponseBase,
response: _R,
name: str,
params: dict[str, Any],
*,
after: EventAfterType = "receive",
) -> HttpResponseBase:
) -> _R:
if after == "receive":
header = "HX-Trigger"
elif after == "settle":
Expand Down

0 comments on commit cfe59fe

Please sign in to comment.