-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#116 move htmx request type into helpers module
- Loading branch information
Showing
4 changed files
with
17 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
from django.contrib.auth.models import User | ||
from django.http import HttpRequest | ||
from django_htmx.middleware import HtmxDetails | ||
|
||
from .htmx_helpers import HtmxHttpRequest | ||
|
||
|
||
class AuthenticatedHttpRequest(HttpRequest): | ||
user: User | ||
|
||
|
||
class HtmxHttpRequest(HttpRequest): | ||
htmx: HtmxDetails | ||
__all__ = [ | ||
"HtmxHttpRequest", | ||
"AuthenticatedHttpRequest", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.http import HttpRequest | ||
from django_htmx.middleware import HtmxDetails | ||
|
||
|
||
# Typing pattern recommended by django-stubs: | ||
# https://github.com/typeddjango/django-stubs#how-can-i-create-a-httprequest-thats-guaranteed-to-have-an-authenticated-user | ||
class HtmxHttpRequest(HttpRequest): | ||
htmx: HtmxDetails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters