I'm trying to add the template of the Django Administration to a simple app view with staff member permissions. I've added {% extends "admin/base_site.html" %}
at the top of my view, but some parts of the header are missing.
Normal admin header:
Test view with admin template:
my_app/urls.py:
from django.urls import path
from . import views
urlpatterns = [
path('test/', views.test, name='test')
]
my_app/views.py:
from django.contrib.admin.views.decorators import staff_member_required
from django.shortcuts import render
@staff_member_required
def test(request):
return render(request, 'test.html')
my_app/templates/test.html:
{% extends "admin/base_site.html" %}
{% block content %}
<p>Test</p>
{% endblock %}
my_project/urls.py:
from django.contrib import admin
from django.urls import include, path
admin.autodiscover()
admin.site.site_header = "Test 1"
admin.site.index_title = "Test 2"
admin.site.site_title = "Test 3"
urlpatterns = [
path('my_app/', include('my_proj.my_app.urls')),
path('', admin.site.urls),
]
Thank you!