custom browsable api header

This commit is contained in:
vabene1111
2020-06-17 10:12:27 +02:00
parent d012385088
commit de413f1473
4 changed files with 22 additions and 3 deletions

2
.idea/recipes.iml generated
View File

@@ -27,8 +27,8 @@
<option name="TEMPLATE_CONFIGURATION" value="Django" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/templates" />
<option value="$MODULE_DIR$/cookbook/templates" />
<option value="$MODULE_DIR$/recipes/templates" />
</list>
</option>
</component>

View File

@@ -0,0 +1,19 @@
{% extends "rest_framework/base.html" %}
{% load i18n %}
{% block branding %}
<a class="navbar-brand" href="{% url 'index' %}">{% trans 'Recipe Home' %}</a>
{% endblock %}
{% block userlinks %}
<ul class="nav navbar-nav">
<li>
<a class='navbar-link' rel="noreferrer nofollow" target="_blank" href='https://www.django-rest-framework.org/'>
Django REST framework
</a>
</li>
</ul>
{{ block.super }}
{% endblock %}

View File

@@ -26,7 +26,7 @@ def theme_url(request):
def nav_color(request):
if not request.user.is_authenticated:
return 'primary'
return request.user.userpreference.nav_color
return request.user.userpreference.nav_color.lower()
@register.simple_tag

View File

@@ -102,7 +102,7 @@ ROOT_URLCONF = 'recipes.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'DIRS': [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'cookbook', 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [