Skip to content

Commit

Permalink
🎨 fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
krmax44 committed Feb 5, 2024
1 parent 335a89d commit a94a715
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions fragdenstaat_de/fds_cms/templatetags/fds_cms_tags.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django import template
from django.conf import settings

from cms.models import StaticPlaceholder, Page
from cms.models import Page, StaticPlaceholder

from ..responsive_images import (
ResponsiveImage,
Expand Down Expand Up @@ -78,17 +78,18 @@ def get_soft_root(page):
return soft_root
return page.get_root()


@register.simple_tag(takes_context=True)
def get_breadcrumb_ancestor(context, navigation_node):
print(context)
if navigation_node == None:
return

try:
request = context["request"]
except KeyError:
return

page = Page.objects.get(pk=navigation_node.id)

try:
Expand All @@ -99,12 +100,12 @@ def get_breadcrumb_ancestor(context, navigation_node):

if ancestor == None:
return

if only_upwards and request.current_page != page:
return

title = ancestor.get_title(language=request.LANGUAGE_CODE)
url = ancestor.get_absolute_url(language=request.LANGUAGE_CODE)
icon = ancestor.fdspageextension.icon

return {"title": title, "url": url, "icon": icon}
return {"title": title, "url": url, "icon": icon}

0 comments on commit a94a715

Please sign in to comment.