Skip to content

Commit

Permalink
Mark view with @login_not_required
Browse files Browse the repository at this point in the history
Fixes #281.
  • Loading branch information
adamchainz committed Aug 15, 2024
1 parent 02f56db commit bf0f27e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Changelog
=========

* Mark the view as public with ``@login_not_required`` on Django 5.1, for compatibility with ``LoginRequiredMiddleware``.

Thanks to Macktireh Abdi Soubaneh for the report in `Issue #281 <https://github.com/adamchainz/django-browser-reload/issues/281>`__.

1.13.0 (2024-06-19)
-------------------

Expand Down
9 changes: 9 additions & 0 deletions src/django_browser_reload/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,12 @@ def event_stream() -> Generator[bytes]:
# Set a content-encoding to bypass GzipMiddleware etc.
response["content-encoding"] = ""
return response


if django.VERSION >= (5, 1):
# isort: off
from django.contrib.auth.decorators import login_not_required # type: ignore [attr-defined]

# isort: on

events = login_not_required(events)

0 comments on commit bf0f27e

Please sign in to comment.