Skip to content

Commit 83233b0

Browse files
authored
fix: default current app in header breadcrumb (#1520)
1 parent 354836d commit 83233b0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/unfold/templatetags/unfold.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,11 @@ def querystring_params(
611611
def header_title(context: RequestContext) -> str:
612612
parts = []
613613
opts = context.get("opts")
614-
current_app = context.request.current_app
614+
current_app = (
615+
context.request.current_app
616+
if hasattr(context.request, "current_app")
617+
else "admin"
618+
)
615619

616620
if opts:
617621
parts.append(
@@ -739,7 +743,11 @@ def header_title(context: RequestContext) -> str:
739743

740744
@register.simple_tag(takes_context=True)
741745
def admin_object_app_url(context: RequestContext, object: Model, arg: str) -> str:
742-
current_app = context.request.current_app
746+
current_app = (
747+
context.request.current_app
748+
if hasattr(context.request, "current_app")
749+
else "admin"
750+
)
743751

744752
return f"{current_app}:{object._meta.app_label}_{object._meta.model_name}_{arg}"
745753

0 commit comments

Comments
 (0)