From 807700701f88085d514a75474b17f8e85bfd1ebd Mon Sep 17 00:00:00 2001
From: Radek Czajka <rczajka@rczajka.pl>
Date: Mon, 26 Sep 2022 12:47:14 +0200
Subject: [PATCH] chunk edit fix

---
 src/chunks/templatetags/chunks.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/chunks/templatetags/chunks.py b/src/chunks/templatetags/chunks.py
index 7c431c13d..b8e9f4f6d 100644
--- a/src/chunks/templatetags/chunks.py
+++ b/src/chunks/templatetags/chunks.py
@@ -25,7 +25,7 @@ def chunk(context, key, cache_time=0):
         n.save()
         content = ''
 
-    if context['request'].user.is_staff:
+    if 'request' in context and context['request'].user.is_staff:
         content = f'<span data-edit="chunks/chunk/{key}"></span>' + content
 
     return mark_safe(content)
-- 
2.20.1