-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Description
Issue Title: Custom base.html from Django REST Framework Not Loading Template Tags
Description
I'm working on customizing the base.html file from the Django REST Framework (DRF) plugin to extend its functionality beyond the original limitations. To achieve this, I copied the base.html file into a template folder within my application.
Issue Details
However, when attempting to load this custom template, I encounter a TemplateSyntaxError related to the optional_logout template tag not receiving the csrf_token argument.
Exception Type: TemplateSyntaxError at /events/
Exception Value: ‘optional_logout’ did not receive value(s) for the argument(s): ‘csrf_token’I suspect the issue arises because my template is unable to load the template tags from the Django REST Framework. Below is my application and middleware configuration for reference:
# Application and Middleware Configuration
Django Version: 5.0.3
Python Version: 3.11.8
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'daphne',
'django.contrib.staticfiles',
'corsheaders',
'rest_framework',
'django_eventstream',
'django_celery_results',
'django_celery_beat',
'puml_generator',
'drf_spectacular',
'drf_spectacular_sidecar',
'app']
Installed Middleware:
['corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_grip.GripMiddleware']Despite my efforts, I’ve been unable to find relevant information or solutions to this problem.
Questions
1. Is there a need to replicate the template tags from the Django REST Framework in my own application to resolve this issue?
2. Is there a specific configuration step I am missing to ensure the custom base.html template properly loads the DRF template tags?
Additional Context
The custom base.html file I’m using is identical to the one found at the official Django REST Framework GitHub repository:
Any assistance or guidance on how to address this issue would be greatly appreciated.
Thank you!