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

Django upgrades #255

Merged
merged 5 commits into from
Jun 18, 2017
Merged

Django upgrades #255

merged 5 commits into from
Jun 18, 2017

Conversation

georgebrock
Copy link
Member

@georgebrock georgebrock commented Jun 12, 2017

This is still work in progress: given how infrequently we get around to the major upgrades, I don't want to merge it until we get to 1.11, which it the next LTS release after 1.8.

  • Django 1.9
  • Django 1.10
  • Django 1.11

The upgrade was motivated by #254 (more notes over there).

Some changes were required for compatibility:

- Use format_html with simple_tag for Django 1.9
  cf. https://docs.djangoproject.com/en/1.11/releases/1.9/#simple-tag-now-wraps-tag-output-in-conditional-escape

- Remove templatetag_sugar for Django 1.9

  The latest version of templatetag_sugar isn't compatible with Django after
  version 1.8.

- Use relative imports.

  It looks like the default load path changed in Django 1.9 -- it was no
  longer possible to load these modules from the global module using their
  name relative to the website module.
Some changes were required for comaptibility:

- URL config has changed: we can no longer pass strings instead of
  callables, and `patterns` has been removed.

- `django.core.context_processors` is has become
  `django.template.context_processors`

- `render_to_response` and `render_to_string` no longer take a context
  instance.

  In places where this wasn't important, the parameter has been removed.
  In places where the template needs a reference to the request (e.g. for
  the current mission) the views have been converted to generic CBVs.
Confusingly, there are two types of Template. There's the engine-specific
version (django.templates.backends.django.Template) and the generic version
(djangot.templates.base.Template).

The engine-specific template composes a generic template. The production
code was expecting an engine-specific template, but the test was using a
generic template.
Template context must be a dict instead of a context instance now, so a test
needed changing.
@georgebrock
Copy link
Member Author

Everything appears to be working on Django 1.11. This is no longer work in progress.

@jaylett
Copy link
Member

jaylett commented Jun 18, 2017

LGTM 👍

@georgebrock georgebrock merged commit 81a2a63 into master Jun 18, 2017
@georgebrock georgebrock deleted the django-upgrades branch June 18, 2017 16:03
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.

None yet

2 participants