Skip to content

Adding Django 3 support#677

Closed
adamcharnock wants to merge 20 commits intosilverapp:masterfrom
adamcharnock:pr/01-django-3-python-3
Closed

Adding Django 3 support#677
adamcharnock wants to merge 20 commits intosilverapp:masterfrom
adamcharnock:pr/01-django-3-python-3

Conversation

@adamcharnock
Copy link
Copy Markdown
Contributor

As per #676, I've gone ahead and brought all dependencies up to date and got all tests passing. Note:

  • Running against Django 3.1.5
  • Fixed various warnings
  • Now using Django's internal JSONField
  • Removed all Python 2 compatibility imports, which are largely gone from Django 3 anyway
  • I managed my own environment using poetry, but I haven't committed those files. I've updated the various requirements files with the new versions, so CI should pass.

I'm sorry that this this is a big PR, but I don't really think there a practical way to do this incrementally. I've tried to make every commit pretty stand-alone though, so you should be able to walk through the individual commits and see what is going on. It's mostly very simple changes over a large number of files.

@adamcharnock adamcharnock changed the title Pr/01 django 3 python 3 Adding Django 3 support Jan 10, 2021
@adamcharnock
Copy link
Copy Markdown
Contributor Author

It looks like the generic (not postgres-specific) JSONField is only in Django 3. So it looks like keeping Django <3 support is going to require keeping a third-party JSON field library in the requirements.

So, forgive me for asking, but is there any appetite for doing a major (backwards-compatible) release which drops support Django < 3, and older Python versions too?

@bogdanpetrea
Copy link
Copy Markdown
Contributor

It looks like the generic (not postgres-specific) JSONField is only in Django 3. So it looks like keeping Django <3 support is going to require keeping a third-party JSON field library in the requirements.

So, forgive me for asking, but is there any appetite for doing a major (backwards-compatible) release which drops support Django < 3, and older Python versions too?

No, Django > 3 and Python >= 3.6 should be the way to go forward. I'm only concerned about migrating existing data from the third-party JSONField to the Django in-built one.

@bogdanpetrea
Copy link
Copy Markdown
Contributor

Hey @adamcharnock , I've changed our Drone config and the Travis one to use Django>3 and Python>3.6. Please rebase your PR branch onto master.

Happy to re-add formatting later, I just need to know which tool you used to do it.

Also, maybe we'll move to poetry.
…rce_str()

Warning was:

    RemovedInDjango40Warning: force_text() is deprecated in favor of force_str().
Warning was:

    MigrationNotice: `XXX.filter_class` attribute should be renamed `filterset_class`. See: https://django-filter.readthedocs.io/en/master/guide/migration.html
Warning was:

    RemovedInDjango40Warning: django.conf.urls.url() is deprecated in favor of django.urls.re_path().
Warning was:

    RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is deprecated in favor of django.utils.translation.gettext_lazy().
…s fix)

    Warning was:

        RemovedInDjango40Warning: django.conf.urls.url() is deprecated in favor of django.urls.re_path().
JWT library now requires the `algorithms` parameter to be specified when decoding. Silver uses the default algorithm when encoding (HS256), so I specified that for the decoding.
    NullBooleanField is deprecated. Support for it (except in historical migrations) will be removed in Django 4.0.
	HINT: Use BooleanField(null=True) instead.

Adding migration for this and previous change to JSONField default values
    ?: (admin.W411) 'django.template.context_processors.request' must be enabled in DjangoTemplates (TEMPLATES) in order to use the admin navigation sidebar.
@adamcharnock adamcharnock force-pushed the pr/01-django-3-python-3 branch from af0104d to eda8766 Compare January 12, 2021 11:38
@adamcharnock
Copy link
Copy Markdown
Contributor Author

@bogdanpetrea Rebase done

@bogdanpetrea
Copy link
Copy Markdown
Contributor

Included and merged in a separate PR (#680). Thanks again!

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.

2 participants