django.contrib.postgres's JSONField is deprecated (#71619)
This commit is contained in:
parent
5788e9f0cd
commit
3fcbe2198c
|
@ -1,12 +1,17 @@
|
|||
# Generated by Django 2.2.15 on 2020-08-23 16:56
|
||||
|
||||
import django
|
||||
import django.contrib.postgres.fields
|
||||
import django.contrib.postgres.fields.jsonb
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
from django.utils import timezone
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
@ -65,7 +70,7 @@ class Migration(migrations.Migration):
|
|||
verbose_name='reference ct ids',
|
||||
),
|
||||
),
|
||||
('data', django.contrib.postgres.fields.jsonb.JSONField(null=True, verbose_name='data')),
|
||||
('data', JSONField(null=True, verbose_name='data')),
|
||||
(
|
||||
'session',
|
||||
models.ForeignKey(
|
||||
|
|
|
@ -26,7 +26,7 @@ import django
|
|||
from django.conf import settings
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.postgres.fields import ArrayField, JSONField
|
||||
from django.contrib.postgres.fields import ArrayField
|
||||
from django.contrib.postgres.fields.jsonb import KeyTextTransform
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db import models
|
||||
|
@ -39,6 +39,11 @@ from authentic2.utils.cache import GlobalCache
|
|||
|
||||
from . import sql
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
User = get_user_model()
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
# Generated by Django 2.2.12 on 2020-05-05 14:16
|
||||
|
||||
import django.contrib.postgres.fields.jsonb
|
||||
import django
|
||||
from django.db import migrations, models
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
@ -30,9 +35,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
(
|
||||
'old_data',
|
||||
django.contrib.postgres.fields.jsonb.JSONField(
|
||||
blank=True, null=True, verbose_name='Old data'
|
||||
),
|
||||
JSONField(blank=True, null=True, verbose_name='Old data'),
|
||||
),
|
||||
],
|
||||
options={
|
||||
|
|
|
@ -2,11 +2,16 @@
|
|||
|
||||
import uuid
|
||||
|
||||
import django.contrib.postgres.fields.jsonb
|
||||
import django
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
@ -48,9 +53,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
(
|
||||
'data',
|
||||
django.contrib.postgres.fields.jsonb.JSONField(
|
||||
blank=True, null=True, verbose_name='data'
|
||||
),
|
||||
JSONField(blank=True, null=True, verbose_name='data'),
|
||||
),
|
||||
(
|
||||
'profile_type',
|
||||
|
|
|
@ -22,12 +22,12 @@ import operator
|
|||
import os
|
||||
import uuid
|
||||
|
||||
import django
|
||||
from django.contrib import auth
|
||||
from django.contrib.auth.models import AbstractBaseUser, Group
|
||||
from django.contrib.auth.models import Permission as AuthPermission
|
||||
from django.contrib.auth.models import _user_has_module_perms, _user_has_perm
|
||||
from django.contrib.contenttypes.fields import GenericRelation
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.core.exceptions import MultipleObjectsReturned, ValidationError
|
||||
from django.core.mail import send_mail
|
||||
from django.db import models, transaction
|
||||
|
@ -57,6 +57,11 @@ from authentic2.validators import PhoneNumberValidator, email_validator
|
|||
from .backends import DjangoRBACBackend
|
||||
from .managers import UserManager, UserQuerySet
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
@RequestCache
|
||||
def get_attributes_map():
|
||||
|
|
|
@ -2,9 +2,14 @@
|
|||
|
||||
import uuid
|
||||
|
||||
import django.contrib.postgres.fields.jsonb
|
||||
import django
|
||||
from django.db import migrations, models
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
@ -29,7 +34,7 @@ class Migration(migrations.Migration):
|
|||
('kind', models.CharField(max_length=32, verbose_name='Kind')),
|
||||
(
|
||||
'content',
|
||||
django.contrib.postgres.fields.jsonb.JSONField(blank=True, verbose_name='Content'),
|
||||
JSONField(blank=True, verbose_name='Content'),
|
||||
),
|
||||
('created', models.DateTimeField(verbose_name='Creation date', auto_now_add=True)),
|
||||
('expires', models.DateTimeField(verbose_name='Expires')),
|
||||
|
|
|
@ -27,7 +27,6 @@ from django.conf import settings
|
|||
from django.contrib import auth
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.postgres.fields import jsonb
|
||||
from django.contrib.postgres.indexes import GinIndex
|
||||
from django.contrib.postgres.search import SearchVectorField
|
||||
from django.core.exceptions import PermissionDenied, ValidationError
|
||||
|
@ -50,6 +49,11 @@ from . import managers
|
|||
from . import natural_key as unused_natural_key # pylint: disable=unused-import
|
||||
from .utils.misc import ServiceAccessDenied
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
class UserExternalId(models.Model):
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('user'), on_delete=models.CASCADE)
|
||||
|
@ -538,7 +542,7 @@ class Token(models.Model):
|
|||
verbose_name=_('Identifier'), primary_key=True, default=uuid.uuid4, editable=False
|
||||
)
|
||||
kind = models.CharField(verbose_name=_('Kind'), max_length=32)
|
||||
content = jsonb.JSONField(verbose_name=_('Content'), blank=True)
|
||||
content = JSONField(verbose_name=_('Content'), blank=True)
|
||||
created = models.DateTimeField(verbose_name=_('Creation date'), auto_now_add=True)
|
||||
expires = models.DateTimeField(verbose_name=_('Expires'))
|
||||
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
import django.contrib.postgres.fields.jsonb
|
||||
import django
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
import authentic2_auth_oidc.models
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
@ -88,7 +93,7 @@ class Migration(migrations.Migration):
|
|||
('scopes', models.CharField(max_length=128, verbose_name='scopes', blank=True)),
|
||||
(
|
||||
'jwkset_json',
|
||||
django.contrib.postgres.fields.jsonb.JSONField(
|
||||
JSONField(
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name='JSON WebKey set',
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
import json
|
||||
|
||||
import django
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
from django.shortcuts import render
|
||||
|
@ -36,6 +36,11 @@ from authentic2.utils.template import validate_template
|
|||
|
||||
from . import managers
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
def validate_jwkset(data):
|
||||
data = json.dumps(data)
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
# Generated by Django 2.2.26 on 2022-06-15 15:00
|
||||
|
||||
import django.contrib.postgres.fields.jsonb
|
||||
import django
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
import authentic2_auth_saml.models
|
||||
from authentic2_auth_saml.models import NAME_ID_FORMAT_CHOICES
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
@ -203,7 +208,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
(
|
||||
'lookup_by_attributes',
|
||||
django.contrib.postgres.fields.jsonb.JSONField(
|
||||
JSONField(
|
||||
blank=True,
|
||||
default=list,
|
||||
help_text=(
|
||||
|
@ -218,7 +223,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
(
|
||||
'a2_attribute_mapping',
|
||||
django.contrib.postgres.fields.jsonb.JSONField(
|
||||
JSONField(
|
||||
blank=True,
|
||||
default=list,
|
||||
help_text=(
|
||||
|
@ -230,7 +235,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
(
|
||||
'attribute_mapping',
|
||||
django.contrib.postgres.fields.jsonb.JSONField(
|
||||
JSONField(
|
||||
blank=True,
|
||||
default=dict,
|
||||
help_text=(
|
||||
|
@ -242,7 +247,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
(
|
||||
'superuser_mapping',
|
||||
django.contrib.postgres.fields.jsonb.JSONField(
|
||||
JSONField(
|
||||
blank=True,
|
||||
default=dict,
|
||||
editable=False,
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
import django
|
||||
import lasso
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
|
@ -32,6 +32,11 @@ from authentic2.apps.authenticators.models import (
|
|||
)
|
||||
from authentic2.utils.misc import redirect_to_login
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
NAME_ID_FORMAT_CHOICES = (
|
||||
('', _('None')),
|
||||
(
|
||||
|
|
Loading…
Reference in New Issue