Add documentation for htmx

This commit is contained in:
2024-10-19 16:24:49 +02:00
parent 3af5d96bf5
commit ec7d45fd91
6 changed files with 28 additions and 2 deletions

View File

@ -327,6 +327,8 @@ class DetailFormView(SingleObjectMixin, FormView):
class AllowFragment:
"""Add `is_fragment` to templates. It's only True if the request is emitted by htmx"""
def get_context_data(self, **kwargs):
kwargs["is_fragment"] = self.request.headers.get("HX-Request", False)
return super().get_context_data(**kwargs)