django-fastdev: Version 1.10.0 - "invalid blocks specified" in Django admin site

Django 5.1.2 django-fastdev 1.10.0 DEBUG = True

1.10.0 fails with the exception ‘invalid blocks specified’ - exception page extract below.

1.9.0 works fine. My own pages seem unaffected. Please let me know what additional info you need.

PS - I’m the Pat you’ve helped a lot on the iommi discourse 😃

Extract from settings.py:

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_fastdev',
]

MIDDLEWARE = [
    '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',
]

ROOT_URLCONF = 'mysite.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'mysite.wsgi.application'


# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}


# Password validation
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/5.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'America/New_York'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

Visiting localhost:8000/admin with 1.10.0 shows the exception page:

<h1>Exception
       at /admin/</h1>
  <pre class="exception_value">Invalid blocks specified:

    nav-breadcrumbs
    nav-sidebar

Valid blocks:

    blockbots
    bodyclass
    branding
    coltype
    content
    content_subtitle
    content_title
    dark-mode-vars
    extrahead
    extrastyle
    footer
    messages
    nav-global
    object-tools
    pretitle
    responsive
    sidebar
    stylesheet
    title</pre>
  
Request Method: | GET
-- | --
http://localhost:8800/admin/
5.1.2
Exception
Invalid blocks specified:      nav-breadcrumbs     nav-sidebar  Valid blocks:      blockbots     bodyclass     branding     coltype     content     content_subtitle     content_title     dark-mode-vars     extrahead     extrastyle     footer     messages     nav-global     object-tools     pretitle     responsive     sidebar     stylesheet     title
/home/pat/git/djangomoney/lib/python3.12/site-packages/django_fastdev/apps.py, line 428, in extends_render
django.contrib.admin.sites.index
/home/pat/git/djangomoney/bin/python
3.12.6
['/home/pat/git/djangomoney',  '/home/pat/git/djangomoney',  '/home/pat/pycharm/plugins/python-ce/helpers/pycharm_display',  '/usr/lib/python312.zip',  '/usr/lib/python3.12',  '/usr/lib/python3.12/lib-dynload',  '/home/pat/git/djangomoney/lib/python3.12/site-packages',  '/home/pat/pycharm/plugins/python-ce/helpers/pycharm_matplotlib_backend',  '/home/pat/pycharm/plugins/python-ce/helpers/pycharm_plotly_backend']
Tue, 08 Oct 2024 15:01:02 -0400
<h2>Error during template rendering</h2>
   <p>In template <code>/home/pat/git/djangomoney/lib/python3.12/site-packages/django/contrib/admin/templates/admin/index.html</code>, error at line <strong>1</strong></p>
   <h3>Invalid blocks specified:

    nav-breadcrumbs
    nav-sidebar

Valid blocks:

    blockbots
    bodyclass
    branding
    coltype
    content
    content_subtitle
    content_title
    dark-mode-vars
    extrahead
    extrastyle
    footer
    messages
    nav-global
    object-tools
    pretitle
    responsive
    sidebar
    stylesheet
    title</h3>
   
1 | {% extends "admin/base_site.html" %}
-- | --
{% load i18n static %}
 
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" href="{% static "admin/css/dashboard.css" %}">{% endblock %}
 
{% block coltype %}colMS{% endblock %}
 
{% block bodyclass %}{{ block.super }} dashboard{% endblock %}
 
{% block nav-breadcrumbs %}{% endblock %}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

I released 1.12.0 with this fix

I don’t have a discord, but you can use the Unofficial Django Discord or iommi offtopic channels

After I fixed the problem in https://github.com/boxed/django-fastdev/issues/47#issuecomment-2408610254, the original exception returned. Looking at the context, it is the one Django is using to render the page, which invalidates my first assumption in https://github.com/boxed/django-fastdev/issues/47#issuecomment-2408585873. So I’m going to have do more digging into what Django is doing.

@boxed - Sorry to be so chatty in the comments, but I want to keep you up to date with what I’m trying as you seem to be working on this too. I can keep commenting here, or do you have a Discord for fastdev?