Upgrading¶
If you’re looking to upgrade from an older version of django-browserid, you’re in the right place. This document describes the major changes required to get your site up to the latest and greatest!
1.0.0 to 2.0.0¶
2.0.0 introduces a small, but backwards-incompatible change that shouldn’t affect most users. You are only affected if you:
- Use the
browserid_login
orbrowserid_logout
template helpers to generate your login/logout buttons, and - Use custom JavaScript that relies on the
data-next
attribute on the buttons generate by these helpers.
If both of the above apply to you, then you may have to update your custom
JavaScript, as the helpers now default to a blank data-next
value instead
of defaulting to the LOGIN_REDIRECT_URL
/LOGOUT_REDIRECT_URL
settings.
The default JavaScript does not rely on this, and it’s not expected that any project relies on this either. Most projects should be able to upgrade to the new version with no changes.
0.10.1 to 1.0.0¶
No changes are necessary to switch from 0.10.1 to 1.0.0. fancy_tag
was
removed as a dependency in 1.0.0, in case you explicitly include it for your
application.
0.9 to 0.10.1¶
The minimum supported version of requests is now 1.0.0, and six has been removed from the requirements.
Replace the
SITE_URL
setting withBROWSERID_AUDIENCES
, which is essentially the same setting, but must be a list of strings (wrapping your oldSITE_URL
value with square brackets to make it a list is fine):BROWSERID_AUDIENCES = ['https://www.example.com']
- On local development installs, you can remove
SITE_URL
entirely, asBROWSERID_AUDIENCES
isn’t required whenDEBUG
is True.
- On local development installs, you can remove
In your root urlconf, remove any regex in front of the include for django-browserid urls. Because the new JavaScript relies on views being available at certain URLs, you must not change the path that the django-browserid views are served:
urlpatterns = patterns('', # ... (r'', include('django_browserid.urls')), # ... )
Remove
django_browserid.context_processors.browserid
from yourTEMPLATE_CONTEXT_PROCESSORS
setting, as the context processor no longer exists.browserid.js
has been split intoapi.js
, which contains just the JavaScript API, andbrowserid.js
, which contains the sample code for hooking up login buttons. If you aren’t using thebrowserid_js
helper to include the JavaScript on the page, you probably need to update your project to either include both or justapi.js
.The included JavaScript requires jQuery 1.8 or higher instead of jQuery 1.7.
0.8 to 0.9¶
- Six v1.3 or higher is now required.
0.7.1 to 0.8¶
fancy_tag 0.2.0 has been added to the required libraries.
Rename the
browserid_form
context processor tobrowserid
in theTEMPLATE_CONTEXT_PROCESSORS
setting:TEMPLATE_CONTEXT_PROCESSORS = ( # ... 'django_browserid.context_processors.browserid', # ... )
Replace custom login button code with the new template helpers,
browserid_info
,browserid_login
, andbrowserid_logout
.browserid_info
should be added just below<body>
on any page that includes a login button.browserid_login
andbrowserid_logout
output login and logout links respectively.
It’s now recommended to include the JavaScript for the login buttons using the
browserid_js
helper, which outputs the appropriate<script>
tags.The included JavaScript requires jQuery 1.7 or higher instead of jQuery 1.6.