Skip to content

Commit 884ec85

Browse files
authored
fix: LoginRequiredMiddleware handling (#775)
1 parent 815a33f commit 884ec85

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/unfold/sites.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@
77
from django.http import HttpRequest, HttpResponse
88
from django.template.response import TemplateResponse
99
from django.urls import URLPattern, path, reverse, reverse_lazy
10+
from django.utils.decorators import method_decorator
1011
from django.utils.functional import lazy
1112
from django.utils.module_loading import import_string
13+
from django.views.decorators.cache import never_cache
14+
15+
try:
16+
from django.contrib.auth.decorators import login_not_required
17+
except ImportError:
18+
19+
def login_not_required(func: Callable) -> Callable:
20+
return func
21+
1222

1323
from .dataclasses import Favicon
1424
from .settings import get_config
@@ -178,6 +188,8 @@ def search(
178188
},
179189
)
180190

191+
@method_decorator(never_cache)
192+
@login_not_required
181193
def login(
182194
self, request: HttpRequest, extra_context: Optional[Dict[str, Any]] = None
183195
) -> HttpResponse:

0 commit comments

Comments
 (0)