switch to native postgresql json field (#42647)

This commit is contained in:
Frédéric Péters 2020-05-08 10:20:00 +02:00
parent e2d58ce246
commit 82fec4fd41
4 changed files with 21 additions and 5 deletions

View File

@ -3,8 +3,8 @@
from __future__ import unicode_literals
from django.db import migrations, models
import django.contrib.postgres.fields.jsonb
import django.db.models.deletion
import jsonfield.fields
import passerelle_reunion_fsn.models
@ -45,7 +45,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='fsnreunionconnector',
name='wcs_options',
field=jsonfield.fields.JSONField(blank=True, null=True),
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True),
),
migrations.AddField(
model_name='batch',

View File

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from passerelle.utils.db import EnsureJsonbType
class Migration(migrations.Migration):
dependencies = [
('passerelle_reunion_fsn', '0004_wcs_batches'),
]
operations = [
EnsureJsonbType(model_name='FSNReunionConnector', field_name='wcs_options'),
]

View File

@ -25,6 +25,7 @@ import os.path
import tempfile
from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.core.files import File
from django.core.urlresolvers import reverse
from django.db import models, transaction
@ -34,7 +35,6 @@ from django.utils.dateparse import parse_date, parse_datetime
from django.utils.encoding import force_str, force_text, smart_text
from django.utils.six.moves.urllib import parse as urlparse
from django.utils.translation import ugettext_lazy as _
import jsonfield
from passerelle.base.models import BaseResource
from passerelle.base.signature import sign_url
from passerelle.utils.api import endpoint
@ -121,7 +121,7 @@ class FSNReunionConnector(BaseResource):
help_text=_('Region identifier for this case')
)
wcs_form_slug = models.CharField(max_length=256, blank=True, verbose_name=_('WCS form slug'))
wcs_options = jsonfield.JSONField(null=True, blank=True)
wcs_options = JSONField(null=True, blank=True)
def hourly(self):
self.logger.info('start fetch dossier')

View File

@ -44,7 +44,6 @@ setup(
author_email='ecazenave@entrouvert.com',
packages=find_packages(),
install_requires=[
'django-jsonfield',
'unicodecsv'
],
cmdclass={