[[Image(https://i.stack.imgur.com/UiKiv.png)]]
In the above photo the commented Google Tag Manager text has been
duplicated. Obviously I would like to put the actual tag manager in
there, but it's a simpler example this way. Anything I put in my child
template tag is duplicated when I call `{{ base.super }}` I'm using
Oscar, so here's my inheritance scheme.
[https://github.com/django-oscar/django-
oscar/blob/master/src/oscar/templates/oscar/base.html oscar/base.html]
{{{
#from oscar module
#relevent sections only
{% load i18n %}
{% load static %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE|default:"en-gb" }}" class="{% block
html_class %}no-js{% endblock %}">
<head>
{% block tracking %}
{# Default to using Google analytics #}
{% include "oscar/partials/google_analytics.html" %}
{% endblock %}
</head>
}}}
my base override
{{{
# located in my procject at 'oscar/base.html'
{% extends 'oscar/base.html' %}
{% block tracking %}
{{ block.super }}
<!-- Google Tag Manager -->
<!-- End Google Tag Manager -->
{% endblock %}
}}}
Below is anything else I think could be involved. Any troubleshooting
tips that would help me debug this would be welcome.
my view
{{{
from django.http import HttpResponse
from django.views.generic.base import TemplateView
class BaseTestView(TemplateView):
template_name = "oscar/base.html"
}}}
urls.py
{{{
from myurls import BaseTestView
urlpatterns = [
path('i18n/', include('django.conf.urls.i18n')),
path('admin/', admin.site.urls),
path('base_test', BaseTestView.as_view(), name='base+test'),
##OSCAR###############################################################
path('', include(apps.get_app_config('oscar').urls[0])),
##WAGTAIL#############################################################
path('cms/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
path('pages/', include(wagtail_urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \
+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
}}}
settings.py templates
{{{
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
location('templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
####DEFAULT################################################
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
####DEFAULT################################################
# 'uniquesite.context_processors.metadata',
####OSCAR################################################
'oscar.apps.search.context_processors.search_form',
'oscar.apps.checkout.context_processors.checkout',
'oscar.apps.communication.notifications.context_processors.notifications',
'oscar.core.context_processors.metadata',
],
},
},
]
}}}
There is a copy of this ticket on SO
[https://stackoverflow.com/questions/65819831/django-duplicating-block-
super-content/65823247 here]
--
Ticket URL: <https://code.djangoproject.com/ticket/32377>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => invalid
Comment:
Please see TicketClosingReasons/UseSupportChannels for ways to get help.
--
Ticket URL: <https://code.djangoproject.com/ticket/32377#comment:1>