templatetags/theming_tags

This commit is contained in:
Tobias Lindenberg
2021-01-10 14:10:21 +01:00
parent 325d6e4326
commit bed5b72864
2 changed files with 2 additions and 3 deletions

View File

View File

@@ -1,7 +1,6 @@
from cookbook.models import UserPreference
from django import template
from django.templatetags.static import static
from cookbook.models import UserPreference
from recipes.settings import STICKY_NAV_PREF_DEFAULT
register = template.Library()
@@ -33,7 +32,7 @@ def nav_color(request):
@register.simple_tag
def sticky_nav(request):
if (not request.user.is_authenticated and STICKY_NAV_PREF_DEFAULT) or \
(request.user.is_authenticated and request.user.userpreference.sticky_navbar):
(request.user.is_authenticated and request.user.userpreference.sticky_navbar): # noqa: E501
return 'position: sticky; top: 0; left: 0; z-index: 1000;'
else:
return ''