Skip to content

Loading templates in Django 1.8+ #74

@joshvillbrandt

Description

@joshvillbrandt

Howdy!

After initial installation of django-mass-edit in a Django 1.11 app, I'm getting a TemplateDoesNotExist /admin/app/mymodel-masschange/1,2/ error when selecting two items to bulk edit from an admin list page. The docs mention uncommenting django.template.loaders.eggs.Loader from TEMPLATE_LOADERS in settings.py, but TEMPLATE_LOADERS does exist in my settings settings.py. After some research, it looks like the Django template settings got changed in 1.8.

In that upgrade documentation I noticed that I could add a loaders section and, low and behold, my TemplateDoesNotExist error goes away. As a second attempt, I uncommented APP_DIRS and added some loaders and things seem to work.

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',
            ],
            # using loaders instead of APP_DIRS to get this stupid eggs thing to work for massadmin
            # we should probably undo this at some point
            'loaders': [
                'django.template.loaders.filesystem.Loader',
                'django.template.loaders.app_directories.Loader',
                'django.template.loaders.eggs.Loader',
            ],
        },
    },
]

So, while this works, it doesn't seem like this is the right way to do things any longer. Any idea what the right way to do this is? Maybe massadmin needs to un-egg itself during install?

This may be related to #65 and #70.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions