misc: use postgres JSONField (#42312)

This commit is contained in:
Valentin Deniaud 2020-04-30 12:00:34 +02:00
parent 1626b133e8
commit 5e1c910fbf
43 changed files with 75 additions and 90 deletions

1
debian/control vendored
View File

@ -21,7 +21,6 @@ Depends: ${python:Depends},
python-django-model-utils,
python-requests,
python-setuptools,
python-django-jsonfield,
python-suds,
python-cmislib,
python-lxml,

View File

@ -1,2 +1 @@
jsonfield python-django-jsonfield
django-jsonresponse python-django-jsonresponse

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -23,7 +23,7 @@ class Migration(migrations.Migration):
('name_id', models.CharField(max_length=256, verbose_name='NameID')),
('id_per', models.CharField(max_length=64, verbose_name='ID Per')),
('created', models.DateTimeField(auto_now_add=True, verbose_name='Creation date')),
('extra', jsonfield.fields.JSONField(null=True, verbose_name='Anything')),
('extra', django.contrib.postgres.fields.jsonb.JSONField(null=True, verbose_name='Anything')),
],
options={
'ordering': ['created'],

View File

@ -17,8 +17,8 @@
import datetime
import requests
import xml.etree.ElementTree as ET
import jsonfield
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.utils import six
from django.utils.six.moves.urllib import parse as urlparse
@ -511,7 +511,7 @@ class Link(models.Model):
created = models.DateTimeField(
verbose_name=_('Creation date'),
auto_now_add=True)
extra = jsonfield.JSONField(
extra = JSONField(
verbose_name=_('Anything'),
null=True)

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -18,7 +18,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('api_id', models.CharField(max_length=30, unique=True)),
('data', jsonfield.fields.JSONField(default=dict)),
('data', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
('timestamp', models.DateTimeField(auto_now=True)),
],
),

View File

@ -1,9 +1,9 @@
import datetime
import gzip
from jsonfield import JSONField
from requests import RequestException
from django.contrib.postgres.fields import JSONField
from django.db import connection, models
from django.db.models import Q
from django.utils.http import urlencode

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -18,8 +18,8 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('data_type', models.CharField(max_length=50)),
('data_parameters', jsonfield.fields.JSONField(default={})),
('data_values', jsonfield.fields.JSONField(default={})),
('data_parameters', django.contrib.postgres.fields.jsonb.JSONField(default={})),
('data_values', django.contrib.postgres.fields.jsonb.JSONField(default={})),
('last_update_datetime', models.DateTimeField(auto_now=True)),
],
),

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
from django.db import migrations
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -16,6 +16,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='cartadsdossier',
name='cartads_steps_cache',
field=jsonfield.fields.JSONField(default={}),
field=django.contrib.postgres.fields.jsonb.JSONField(default={}),
),
]

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
from django.db import migrations
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -16,6 +16,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='cartadsdossier',
name='cartads_cache_infos',
field=jsonfield.fields.JSONField(default={}),
field=django.contrib.postgres.fields.jsonb.JSONField(default={}),
),
]

View File

@ -31,6 +31,7 @@ import pdfrw.findobjs
from Crypto.Cipher import AES
from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.core.files.storage import default_storage
from django.core.signing import Signer
from django.core.urlresolvers import reverse
@ -42,7 +43,6 @@ from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from django.utils.six.moves.urllib import parse as urlparse
from jsonfield import JSONField
import zeep.exceptions
import zeep.helpers as zeep_helpers

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -15,7 +15,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='csvdatasource',
name='_dialect_options',
field=jsonfield.fields.JSONField(default=dict, editable=False),
field=django.contrib.postgres.fields.jsonb.JSONField(default=dict, editable=False),
preserve_default=True,
),
]

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -19,6 +19,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='csvdatasource',
name='_dialect_options',
field=jsonfield.fields.JSONField(null=True, editable=False),
field=django.contrib.postgres.fields.jsonb.JSONField(null=True, editable=False),
),
]

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -19,7 +19,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('line_number', models.IntegerField()),
('data', jsonfield.fields.JSONField(blank=True, default=dict)),
('data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict)),
],
options={
'ordering': ('line_number',),

View File

@ -26,8 +26,7 @@ import pytz
from pyexcel_ods import get_data as get_data_ods
from pyexcel_xls import get_data as get_data_xls
import jsonfield
from django.contrib.postgres.fields import JSONField
from django.utils.encoding import force_str, smart_text
from django.utils.timezone import datetime, make_aware
from django.conf import settings
@ -141,7 +140,7 @@ class CsvDataSource(BaseResource):
default='id, text',
help_text=_('ex: id,text,data1,data2'), blank=True)
skip_header = models.BooleanField(_('Skip first line'), default=False)
_dialect_options = jsonfield.JSONField(editable=False, null=True)
_dialect_options = JSONField(editable=False, null=True)
sheet_name = models.CharField(_('Sheet name'), blank=True, max_length=150)
category = _('Data Sources')
@ -494,7 +493,7 @@ class CsvDataSource(BaseResource):
class TableRow(models.Model):
resource = models.ForeignKey('CsvDataSource', on_delete=models.CASCADE)
line_number = models.IntegerField(null=False)
data = jsonfield.JSONField(blank=True)
data = JSONField(blank=True)
class Meta:
ordering = ('line_number',)

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
import passerelle.utils.sftp
@ -25,8 +25,8 @@ class Migration(migrations.Migration):
('creation_datetime', models.DateTimeField(auto_now_add=True)),
('filename', models.CharField(max_length=128, null=True)),
('status', models.CharField(choices=[(b'new', b'New'), (b'sent', b'Sent'), (b'closed', b'Closed')], default=b'new', max_length=8)),
('demand_data', jsonfield.fields.JSONField(default=dict)),
('card_data', jsonfield.fields.JSONField(default=dict)),
('demand_data', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
('card_data', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
],
options={
'get_latest_by': 'creation_datetime',

View File

@ -19,6 +19,7 @@ import io
from collections import OrderedDict
from django.contrib.postgres.fields import JSONField
from django.db import models, transaction, IntegrityError
from django.utils import six
from django.utils.encoding import force_bytes
@ -29,7 +30,6 @@ from passerelle.base.models import BaseResource
from passerelle.utils.api import endpoint, APIError
from passerelle.utils import SFTPField
from jsonfield import JSONField
CSV_DELIMITER = ';'
FILES_ENCODING = 'latin-1'
@ -403,8 +403,8 @@ class Form(models.Model):
status = models.CharField(max_length=8, default='new',
choices=FORM_STATUSES
)
demand_data = JSONField()
card_data = JSONField()
demand_data = JSONField(default=dict)
card_data = JSONField(default=dict)
class Meta:
get_latest_by = 'creation_datetime'

View File

@ -3,7 +3,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
import passerelle.apps.jsondatastore.models
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -19,7 +19,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('uuid', models.CharField(default=passerelle.apps.jsondatastore.models.get_hex_uuid, verbose_name='uuid', unique=True, max_length=32, editable=False)),
('name_id', models.CharField(max_length=256, blank=True)),
('content', jsonfield.fields.JSONField(default=dict, verbose_name='Content')),
('content', django.contrib.postgres.fields.jsonb.JSONField(default=dict, verbose_name='Content')),
('creation_datetime', models.DateTimeField(auto_now_add=True)),
('last_update_datetime', models.DateTimeField(auto_now=True)),
],

View File

@ -16,12 +16,11 @@
import uuid
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.template import Context, Template
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
from passerelle.base.models import BaseResource
from passerelle.compat import json_loads
from passerelle.utils.api import endpoint, APIError

View File

@ -24,14 +24,13 @@ import re
import xml.etree.ElementTree as ET
import zipfile
from django.contrib.postgres.fields import JSONField
from django.db import models, IntegrityError, transaction
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.utils.translation import ugettext_lazy as _
from django.utils import six, functional
import jsonfield
from passerelle.base.models import BaseResource, SkipJob
from passerelle.utils.api import endpoint
from passerelle.utils.jsonresponse import APIError
@ -238,7 +237,7 @@ class Demand(models.Model):
reference = models.CharField(max_length=32, null=False, unique=True)
status = models.CharField(max_length=32, null=True, choices=STATUSES, default=STATUS_PENDING)
step = models.IntegerField(default=0)
data = jsonfield.JSONField()
data = JSONField()
@functional.cached_property
def logger(self):

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
import passerelle.utils.sftp
@ -26,7 +26,7 @@ class Migration(migrations.Migration):
('reference', models.CharField(max_length=32, unique=True)),
('status', models.CharField(choices=[('pending', 'pending'), ('pushed', 'pushed'), ('error', 'error'), ('closed', 'closed'), ('rejected', 'rejected'), ('accepted', 'accepted'), ('information needed', 'information needed'), ('in progress', 'in progress'), ('invalid', 'invalid'), ('imported', 'imported')], default='pending', max_length=32, null=True)),
('step', models.IntegerField(default=0)),
('data', jsonfield.fields.JSONField(default=dict)),
('data', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
],
options={
'verbose_name': 'MDEL compatible DDPACS request',

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -20,7 +20,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('lat', models.FloatField()),
('lon', models.FloatField()),
('data', jsonfield.fields.JSONField(default=dict)),
('data', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
('query', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='features', to='opengis.Query', verbose_name='Query')),
],
),

View File

@ -20,8 +20,8 @@ import xml.etree.ElementTree as ET
import six
import pyproj
from jsonfield import JSONField
from django.contrib.postgres.fields import JSONField
from django.core.cache import cache
from django.db import models, transaction
from django.http import HttpResponse

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -25,7 +25,7 @@ class Migration(migrations.Migration):
('password', models.CharField(max_length=128, verbose_name='Password')),
('keystore', models.FileField(help_text='Certificate and private key in PEM format', upload_to=b'pastell', null=True, verbose_name='Keystore')),
('document_type', models.CharField(max_length=128, verbose_name='Document Type', blank=True)),
('document_fields', jsonfield.fields.JSONField(null=True, verbose_name='Fields')),
('document_fields', django.contrib.postgres.fields.jsonb.JSONField(null=True, verbose_name='Fields')),
('users', models.ManyToManyField(to='base.ApiUser', related_name='_pastell_users_+', related_query_name='+', blank=True)),
],
options={

View File

@ -1,14 +1,13 @@
import requests
from requests.auth import HTTPBasicAuth
from django.contrib.postgres.fields import JSONField
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.db import models
from django.template import Template, Context
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
from passerelle.base.models import BaseResource

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -24,7 +24,7 @@ class Migration(migrations.Migration):
('caller', models.CharField(max_length=64)),
('start_timestamp', models.DateTimeField(auto_now_add=True)),
('end_timestamp', models.DateTimeField(default=None, null=True)),
('details', jsonfield.fields.JSONField(default={})),
('details', django.contrib.postgres.fields.jsonb.JSONField(default={})),
],
options={
'ordering': ['-start_timestamp'],

View File

@ -14,10 +14,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.utils.timezone import now, timedelta, make_naive
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
from passerelle.base.models import BaseResource
from passerelle.utils.api import endpoint

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
import passerelle.apps.sp_fr.models
import passerelle.utils.sftp
import passerelle.utils.wcs
@ -25,7 +25,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('procedure', models.CharField(choices=[(b'DOC', 'Request for construction site opening'), (b'recensementCitoyen', 'Request for mandatory citizen census'), (b'depotDossierPACS', 'Pre-request for citizen solidarity pact')], max_length=32, unique=True, verbose_name='Procedure')),
('formdef', passerelle.utils.wcs.FormDefField(verbose_name='Formdef')),
('rules', jsonfield.fields.JSONField(default=passerelle.apps.sp_fr.models.default_rule, verbose_name='Rules')),
('rules', django.contrib.postgres.fields.jsonb.JSONField(default=passerelle.apps.sp_fr.models.default_rule, verbose_name='Rules')),
],
options={
'verbose_name': 'MDEL mapping',

View File

@ -25,6 +25,7 @@ import datetime
from lxml import etree as ET
from django.contrib.postgres.fields import JSONField
from django.core.urlresolvers import reverse
from django.core.files import File
from django.db import models, transaction
@ -32,8 +33,6 @@ from django.template import engines
from django.utils import six
from django.utils.translation import ugettext_lazy as _, ugettext
from jsonfield import JSONField
from passerelle.base.models import BaseResource
from passerelle.utils.api import endpoint
from passerelle.utils.sftp import SFTPField

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -22,7 +22,7 @@ class Migration(migrations.Migration):
('levelno', models.IntegerField(verbose_name=b'log level')),
('sourceip', models.GenericIPAddressField(null=True, verbose_name='Source IP', blank=True)),
('message', models.TextField(verbose_name=b'message')),
('extra', jsonfield.fields.JSONField(default={}, verbose_name=b'extras')),
('extra', django.contrib.postgres.fields.jsonb.JSONField(default={}, verbose_name=b'extras')),
],
options={
'permissions': (('view_resourcelog', 'Can view resource logs'),),

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -22,12 +22,12 @@ class Migration(migrations.Migration):
('resource_pk', models.PositiveIntegerField()),
('method_name', models.CharField(max_length=50)),
('natural_id', models.CharField(blank=True, max_length=256, null=True)),
('parameters', jsonfield.fields.JSONField(default={})),
('parameters', django.contrib.postgres.fields.jsonb.JSONField(default={})),
('creation_timestamp', models.DateTimeField(auto_now_add=True)),
('update_timestamp', models.DateTimeField(auto_now=True)),
('done_timestamp', models.DateTimeField(null=True)),
('status', models.CharField(choices=[(b'registered', 'Registered'), (b'running', 'Running'), (b'failed', 'Failed'), (b'completed', 'Completed')], default=b'registered', max_length=20)),
('status_details', jsonfield.fields.JSONField(default={})),
('status_details', django.contrib.postgres.fields.jsonb.JSONField(default={})),
('resource_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
],
),

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
import passerelle.base.models
@ -47,7 +47,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='resourcelog',
name='extra',
field=jsonfield.fields.JSONField(default={}, verbose_name='extras'),
field=django.contrib.postgres.fields.jsonb.JSONField(default={}, verbose_name='extras'),
),
migrations.AlterField(
model_name='resourcelog',

View File

@ -13,6 +13,7 @@ import uuid
from django.apps import apps
from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.core.exceptions import ValidationError, ObjectDoesNotExist, PermissionDenied
from django.core.urlresolvers import reverse
from django.db import connection, models, transaction
@ -30,12 +31,8 @@ from django.core.files.base import ContentFile
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import fields
from jsonfield import JSONField
from model_utils.managers import InheritanceManager as ModelUtilsInheritanceManager
import jsonfield
import passerelle
import requests
from passerelle.compat import json_loads
@ -697,7 +694,7 @@ class Job(models.Model):
resource = fields.GenericForeignKey('resource_type', 'resource_pk')
method_name = models.CharField(max_length=50)
natural_id = models.CharField(max_length=256, blank=True, null=True)
parameters = jsonfield.JSONField(default={})
parameters = JSONField(default={})
creation_timestamp = models.DateTimeField(auto_now_add=True)
update_timestamp = models.DateTimeField(auto_now=True)
done_timestamp = models.DateTimeField(null=True)
@ -711,7 +708,7 @@ class Job(models.Model):
('completed', _('Completed'))
),
)
status_details = jsonfield.JSONField(default={})
status_details = JSONField(default={})
def set_after_timestamp(self, value):
if isinstance(value, datetime.datetime):
@ -732,7 +729,7 @@ class ResourceLog(models.Model):
levelno = models.IntegerField(verbose_name='log level')
sourceip = models.GenericIPAddressField(blank=True, null=True, verbose_name=_('Source IP'))
message = models.TextField(verbose_name='message')
extra = jsonfield.JSONField(verbose_name='extras', default={})
extra = JSONField(verbose_name='extras', default={})
class Meta:
ordering = ('id',)

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -19,7 +19,7 @@ class Migration(migrations.Migration):
('title', models.CharField(verbose_name='Title', max_length=50)),
('slug', models.SlugField(verbose_name='Identifier', unique=True)),
('description', models.TextField(verbose_name='Description')),
('jsondatabase', jsonfield.fields.JSONField(default=dict, verbose_name='Fake Database (JSON)', blank=True)),
('jsondatabase', django.contrib.postgres.fields.jsonb.JSONField(default=dict, verbose_name='Fake Database (JSON)', blank=True)),
('users', models.ManyToManyField(to='base.ApiUser', related_name='_fakefamily_users_+', related_query_name='+', blank=True)),
],
options={

View File

@ -14,12 +14,11 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.contrib.postgres.fields import JSONField
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from jsonfield import JSONField
from passerelle.base.models import BaseResource
from .default_database import default_database

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -21,7 +21,7 @@ class Migration(migrations.Migration):
('description', models.TextField(verbose_name='Description')),
('url', models.URLField(verbose_name='Newsletter service URL')),
('apikey', models.CharField(max_length=32, verbose_name='API key')),
('transport_titles_mapping', jsonfield.fields.JSONField(default=dict, verbose_name='Mapping of transports ids and titles')),
('transport_titles_mapping', django.contrib.postgres.fields.jsonb.JSONField(default=dict, verbose_name='Mapping of transports ids and titles')),
('users', models.ManyToManyField(to='base.ApiUser', related_name='_meyzieunewsletters_users_+', related_query_name='+', blank=True)),
],
options={

View File

@ -17,13 +17,12 @@
import requests
import logging
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
from passerelle.base.models import BaseResource
@ -38,7 +37,8 @@ class SubscriptionsGetError(Exception):
class MeyzieuNewsletters(BaseResource):
url = models.URLField(verbose_name=_('Newsletter service URL'))
apikey = models.CharField(max_length=32, verbose_name=_('API key'))
transport_titles_mapping = JSONField(_('Mapping of transports ids and titles'))
transport_titles_mapping = JSONField(_('Mapping of transports ids and titles'),
default=dict)
category = _('Newsletter registration')

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
from django.db import migrations
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -16,6 +16,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='planitechconnector',
name='custom_fields',
field=jsonfield.fields.JSONField(blank=True, null=True, verbose_name='Custom places fields'),
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True, verbose_name='Custom places fields'),
),
]

View File

@ -21,6 +21,7 @@ import json
import re
import uuid
from django.contrib.postgres.fields import JSONField
from django.core.cache import cache
from django.db import models, transaction
from django.utils import dateformat
@ -28,7 +29,6 @@ from django.utils import dateparse
from django.utils.encoding import force_bytes
from django.utils.six.moves.urllib import parse as urlparse
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
from requests.exceptions import RequestException
from passerelle.base.models import BaseResource

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
import django.contrib.postgres.fields.jsonb
class Migration(migrations.Migration):
@ -15,7 +15,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='management',
name='billing_regies',
field=jsonfield.fields.JSONField(default=dict, verbose_name='Mapping between regie ids and billing ids'),
field=django.contrib.postgres.fields.jsonb.JSONField(default=dict, verbose_name='Mapping between regie ids and billing ids'),
preserve_default=True,
),
]

View File

@ -19,14 +19,12 @@ from datetime import datetime
import logging
import xml.etree.ElementTree as ET
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.http import HttpResponse, HttpResponseNotFound
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_text
from jsonfield import JSONField
from passerelle.base.models import BaseResource
from passerelle.compat import json_loads
from passerelle.soap import client_to_jsondict

View File

@ -1,7 +1,6 @@
django >= 1.8, <1.12
django-jsonresponse >= 0.10, < 0.11
django-model-utils
django-jsonfield >= 0.9.3
requests
-e git+http://repos.entrouvert.org/gadjo.git/#egg=gadjo
SOAPpy

View File

@ -86,7 +86,6 @@ setup(name='passerelle',
install_requires=[
'django >= 1.8, <1.12',
'django-model-utils<4',
'django-jsonfield<1.3',
'requests',
'gadjo',
'phpserialize',