Skip to content

Commit

Permalink
Merge pull request #78 from python-social-auth/improvement/django-jso…
Browse files Browse the repository at this point in the history
…n-field-doc

Port Django JSON field integration doc
  • Loading branch information
omab committed Mar 1, 2021
2 parents 0fb63b0 + 3cf330e commit 62ca07c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/configuration/django.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,41 @@ to implement your own alternate, please see the ``social_django.models`` and
``social_django_mongoengine.models`` modules for guidance.


JSON field support
------------------

Django 3.1 introduces `JSONField` support for all backends and adds a
deprecation warning.

These are the related settings to enabling this integration:

- `SOCIAL_AUTH_JSONFIELD_ENABLED` (boolean)

Same behavior, setting name updated to match `JSONField` being supported by
all systems::

SOCIAL_AUTH_POSTGRES_JSONFIELD = True # Before
SOCIAL_AUTH_JSONFIELD_ENABLED = True # After

- `SOCIAL_AUTH_JSONFIELD_CUSTOM` (import path)
Allows specifying an import string. This gives better control to setting a
custom JSONField.

For django systems < 3.1 (technically <4), you can set the old `JSONField`
to maintain behavior with earlier social-app-django releases::

SOCIAL_AUTH_JSONFIELD_CUSTOM = 'django.contrib.postgres.fields.JSONField'

For sites running or upgrading to django 3.1+, then can set this so the new
value::

SOCIAL_AUTH_JSONFIELD_CUSTOM = 'django.db.models.JSONField'

- Deprecating setting: `SOCIAL_AUTH_POSTGRES_JSONFIELD` (bool)
Rename this to `SOCIAL_AUTH_JSONFIELD_ENABLED`. The setting will be deprecated
in a future release.


Exceptions Middleware
---------------------

Expand Down

0 comments on commit 62ca07c

Please sign in to comment.