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

Support for Django 1.9 #13

Merged
merged 24 commits into from Feb 21, 2016

Conversation

Projects
None yet
1 participant
@nigma
Owner

nigma commented Feb 21, 2016

Before Django 1.9 the easy-pjax library used the django.template.base.add_to_builtins private API to automatically register itself in the template built-ins after it was added to the INSTALLED_APPS list.
This workaround was due to the fact that the {% load %} tag cannot be placed before the {% extends %} tag and the pjax template filter could not be loaded explicitly.

Starting from Django 1.9 easy-pjax does not have to rely on such workarounds because Django now provides a clean way to add filters and tags to template built-ins.
This is now the recommended and the only way of installing easy-pjax template tags, also because the add_to_builtins API was removed.

This is a backward incompatible change, but one that makes the integration more explicit and following the Zen of Python.

Example of configuration settings to be used starting from Django 1.9:

INSTALLED_APPS = [
    "easy_pjax"
]
MIDDLEWARE_CLASSES = [
    "easy_pjax.middleware.UnpjaxMiddleware"
]
TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [],
        "APP_DIRS": True,
        "OPTIONS": {
            "builtins": [
                "easy_pjax.templatetags.pjax_tags"
            ],
            "context_processors": [
                "django.template.context_processors.request",
            ]
        }
    }
]

No changes are required for Django 1.8 or older.

This pull request closes #11 and #12.

nigma added a commit that referenced this pull request Feb 21, 2016

Merge pull request #13 from nigma/develop
Support for Django 1.9

@nigma nigma merged commit de3b497 into master Feb 21, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@nigma nigma deleted the develop branch Feb 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment