Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify template inheritance #132

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

Simplify template inheritance #132

wants to merge 9 commits into from

Conversation

telenieko
Copy link
Collaborator

This PR implements solution 2 of #127, that is: When you extend 'adminlte/base.html' you can override the blocks of the included templates. Thus life is easier.

The demo is updated as an example, where now you do not have to override the sidebar template completely, but only the nav_links block from base.html directly. You could override any other block from there.

Docs are not yet updated as this is still very experimental.

To use, you would only need to properly set the tempalte settings as in the demo:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            str(DEMO_ROOT / 'demo' / 'templates'),
        ],
        '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',
            ],
            'loaders': [
                'cruds_adminlte.template_loader.Loader',
                'django.template.loaders.filesystem.Loader',
                'django.template.loaders.app_directories.Loader',
            ]
        }
    },
]

No the loaders settings.

This PR needs #128

@telenieko telenieko changed the title Simplify tempalte inheritance Simplify template inheritance Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant