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 1.11 - another upgrade to LTS Django #56

Merged
merged 22 commits into from
Feb 17, 2019

Conversation

vladimir-mencl-eresearch
Copy link
Collaborator

Hi @zmousm ,

Time flies fast - Django 1.8 went EOL this April, so I've done upgrade to the next LTS - which is Django 1.11.

This time, it wasn't as disruptive as before.

Can you please have a look and merge?

Thanks a lot in advance!

Cheers,
Vlad

url.pattern is now deprecated - return instead a list of url instances.
Replace deprecated django.core.context_processors with django.template.context_processors.
Reversing by dotted path is deprecated.  Pass instead already reversed URL as context parameter.

Add generic context processor reverse_urls - but the only URL used with reverse
with scoped ("dotted") name is set_language.
TEMPLATE_* settings are deprecated - so migrate to TEMPLATES setting as per

https://docs.djangoproject.com/en/1.11/ref/templates/upgrading/

As TEMPLATE_DEBUG is removed as well but the debug option defaults to
settings.DEBUG, and we had been setting TEMPLATE_DEBUG to exactly that,
remove TEMPLATE_DEBUG from local settings.
The SubfieldBase metaclass is deprecated.

Instead, one should use from_db_value and to_python methods:
  https://docs.djangoproject.com/en/1.9/howto/custom-model-fields/#converting-values-to-python-objects

We already have to_python, so add from_db_value - and remove SubfieldBase metaclass.
Fix up accounts/migrations/0001_initial.py to prevent spurious migrations:
Django has changed the admin.AbstractUser definition in ways not affecting DB storage
(whether validator get 'invalid' code - which it otherwise defaults to anyway).
The context_instance parameter passed to render_to_response is deprecated
- and render_to_response() itself is also marked as outdated and likely to be
deprecated in the future.

Change from passing a RequestContext object to render() to calling render()
directly, passing request object to render(), and passing just a dictionary of
context settings as context to render()

Add a utility function merge_dicts to merge the per-view dictionary with the
one returned by base_response().

For reference, see https://docs.djangoproject.com/en/1.9/topics/http/shortcuts/
Python-social-auth needs to be upgraded for Django 1.11.

This is the first step - get to latest before 0.3 (with latest migration)
Replace python-social-auth with social-auth-app-django-2.1.0.

Python-social-auth project is deprecated, so migrate towards social-auth-app-django.

Documentation at
https://github.com/omab/python-social-auth/blob/master/MIGRATING_TO_SOCIAL.md

Update configuration as per the above - INSTALLED_APPS, AUTHENTICATION_BACKENDS,
TEMPLATES context_processores, url patterns.

As social-auth-app-django incorporates python-social-auth DB migrations
history, it is not necessary to first step to latest python-social-auth and the
migration can be done directly.
social-auth-core 1.7.0 requires "requests>=2.9.1"
Fix up accounts/migrations/0001_initial.py (again) to prevent spurious migrations:
Django has changed the admin.AbstractUser definition again in ways not affecting DB storage:
now, th RegexValidator has been replaced with an ASCIIUsernameValidator.
@vladimir-mencl-eresearch
Copy link
Collaborator Author

I've just rebased on master and resolved conflicts (in edumanage/views.py - conflicting with ab6d29a

@vladimir-mencl-eresearch
Copy link
Collaborator Author

Hi @zmousm, documentation added - now over to you for review.

Update social-auth-app-django from 2.1.0 to 3.1.0, use latest 3.x.
social-auth-app-django requires social-auth-core, but is rather lax about the version.

Require at least 3.0.0 - which fixes Google+ login.
@cangus
Copy link
Contributor

cangus commented Feb 17, 2019

Looks clean to me, a couple of tiny things mentioned above.

@cangus
Copy link
Contributor

cangus commented Feb 17, 2019

All comments have been addressed - looks good to merge

@vladimir-mencl-eresearch vladimir-mencl-eresearch merged commit e3d2719 into grnet:master Feb 17, 2019
Copy link
Contributor

@zmousm zmousm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved inline

vladimir-mencl-eresearch added a commit to REANNZ/djnro that referenced this pull request Jun 25, 2019
This has been suggested in grnet#56 anyway.  And the original implementation breaks on python3:
The + cannot be applied to dict_items objects.

The itertools based implementation works on both Py2 and Py3.
vladimir-mencl-eresearch added a commit to REANNZ/djnro that referenced this pull request Jun 25, 2019
This has been suggested in grnet#56 anyway.  And the original implementation breaks on python3:
The + cannot be applied to dict_items objects.

The itertools based implementation works on both Py2 and Py3.
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

3 participants