misc: remove django-jsonfield dependency (#52912)
This commit is contained in:
parent
44ee86eded
commit
657815e82a
|
@ -3,7 +3,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import django.db.models.deletion
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ class Migration(migrations.Migration):
|
|||
('last_update_timestamp', models.DateTimeField(auto_now=True)),
|
||||
('data_reference', models.CharField(max_length=150, verbose_name='Data')),
|
||||
('title', models.CharField(blank=True, max_length=150, verbose_name='Title')),
|
||||
('cached_json', jsonfield.fields.JSONField(blank=True, default=dict)),
|
||||
('cached_json', JSONField(blank=True, default=dict)),
|
||||
(
|
||||
'chart_type',
|
||||
models.CharField(
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Generated by Django 1.11.29 on 2020-12-02 13:24
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
@ -16,11 +16,11 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='chartngcell',
|
||||
name='filter_params',
|
||||
field=jsonfield.fields.JSONField(default=dict),
|
||||
field=JSONField(default=dict),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='statistic',
|
||||
name='filters',
|
||||
field=jsonfield.fields.JSONField(default=list),
|
||||
field=JSONField(default=list),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -24,6 +24,7 @@ import pygal
|
|||
import pygal.util
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import models, transaction
|
||||
from django.template.defaultfilters import date as format_date
|
||||
from django.urls import reverse
|
||||
|
@ -33,7 +34,6 @@ from django.utils.encoding import force_text
|
|||
from django.utils.translation import gettext
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext
|
||||
from jsonfield import JSONField
|
||||
from requests.exceptions import HTTPError, RequestException
|
||||
|
||||
from combo.data.library import register_cell_class
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -84,9 +84,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
(
|
||||
'service_options',
|
||||
jsonfield.fields.JSONField(
|
||||
default=dict, verbose_name='Payment Service Options', blank=True
|
||||
),
|
||||
JSONField(default=dict, verbose_name='Payment Service Options', blank=True),
|
||||
),
|
||||
],
|
||||
options={
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
('start_date', models.DateTimeField(auto_now_add=True)),
|
||||
('end_date', models.DateTimeField(null=True)),
|
||||
('bank_data', jsonfield.fields.JSONField(default=dict, blank=True)),
|
||||
('bank_data', JSONField(default=dict, blank=True)),
|
||||
('order_id', models.CharField(max_length=200)),
|
||||
('items', models.ManyToManyField(to='lingo.BasketItem', blank=True)),
|
||||
],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
('amount', models.DecimalField(max_digits=8, decimal_places=2)),
|
||||
('creation_date', models.DateTimeField(auto_now_add=True)),
|
||||
('bank_result', jsonfield.fields.JSONField(default=dict, blank=True)),
|
||||
('bank_result', JSONField(default=dict, blank=True)),
|
||||
('transaction', models.ForeignKey(to='lingo.Transaction', on_delete=models.CASCADE)),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='basketitem',
|
||||
name='request_data',
|
||||
field=jsonfield.fields.JSONField(default=dict, blank=True),
|
||||
field=JSONField(default=dict, blank=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='regie',
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import django.db.models.deletion
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -50,9 +50,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
(
|
||||
'service_options',
|
||||
jsonfield.fields.JSONField(
|
||||
blank=True, default=dict, verbose_name='Payment Service Options'
|
||||
),
|
||||
JSONField(blank=True, default=dict, verbose_name='Payment Service Options'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Generated by Django 1.11.18 on 2019-05-14 12:02
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
from combo.apps.lingo.models import SERVICES
|
||||
|
@ -18,7 +18,7 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='regie',
|
||||
name='transaction_options',
|
||||
field=jsonfield.fields.JSONField(blank=True, default=dict, verbose_name='Transaction Options'),
|
||||
field=JSONField(blank=True, default=dict, verbose_name='Transaction Options'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='paymentbackend',
|
||||
|
|
|
@ -27,6 +27,7 @@ import eopayment
|
|||
from dateutil import parser
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.core import serializers
|
||||
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
|
||||
from django.core.mail import EmailMultiAlternatives
|
||||
|
@ -42,7 +43,6 @@ from django.utils.formats import localize
|
|||
from django.utils.six.moves.urllib import parse as urlparse
|
||||
from django.utils.timezone import make_aware, now, utc
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from jsonfield import JSONField
|
||||
from requests import RequestException
|
||||
|
||||
from combo.apps.notifications.models import Notification
|
||||
|
@ -150,7 +150,7 @@ class PaymentBackend(models.Model):
|
|||
help_text=_('The identifier is used in webservice calls and callback URLs for the payment backend.'),
|
||||
)
|
||||
service = models.CharField(verbose_name=_('Payment Service'), max_length=64, choices=SERVICES)
|
||||
service_options = JSONField(blank=True, verbose_name=_('Payment Service Options'))
|
||||
service_options = JSONField(blank=True, default=dict, verbose_name=_('Payment Service Options'))
|
||||
|
||||
objects = PaymentBackendManager()
|
||||
|
||||
|
@ -304,7 +304,7 @@ class Regie(models.Model):
|
|||
payment_backend = models.ForeignKey(
|
||||
PaymentBackend, on_delete=models.CASCADE, verbose_name=_('Payment backend')
|
||||
)
|
||||
transaction_options = JSONField(blank=True, verbose_name=_('Transaction Options'))
|
||||
transaction_options = JSONField(blank=True, default=dict, verbose_name=_('Transaction Options'))
|
||||
can_pay_only_one_basket_item = models.BooleanField(
|
||||
default=True, verbose_name=_('Basket items must be paid individually')
|
||||
)
|
||||
|
@ -621,7 +621,7 @@ class BasketItem(models.Model):
|
|||
source_url = models.URLField(_('Source URL'), blank=True)
|
||||
details = models.TextField(verbose_name=_('Details'), blank=True)
|
||||
amount = models.DecimalField(verbose_name=_('Amount'), decimal_places=2, max_digits=8)
|
||||
request_data = JSONField(blank=True)
|
||||
request_data = JSONField(blank=True, default=dict)
|
||||
extra_fee = models.BooleanField(default=False)
|
||||
user_cancellable = models.BooleanField(default=True)
|
||||
creation_date = models.DateTimeField(auto_now_add=True)
|
||||
|
@ -812,7 +812,7 @@ class Transaction(models.Model):
|
|||
to_be_paid_remote_items = models.CharField(max_length=512, null=True)
|
||||
start_date = models.DateTimeField(auto_now_add=True)
|
||||
end_date = models.DateTimeField(null=True)
|
||||
bank_data = JSONField(blank=True)
|
||||
bank_data = JSONField(blank=True, default=dict)
|
||||
order_id = models.CharField(max_length=200)
|
||||
bank_transaction_id = models.CharField(max_length=200, null=True)
|
||||
bank_transaction_date = models.DateTimeField(blank=True, null=True)
|
||||
|
@ -1035,7 +1035,7 @@ class TransactionOperation(models.Model):
|
|||
kind = models.CharField(max_length=65, choices=OPERATIONS)
|
||||
amount = models.DecimalField(decimal_places=2, max_digits=8)
|
||||
creation_date = models.DateTimeField(auto_now_add=True)
|
||||
bank_result = JSONField(blank=True)
|
||||
bank_result = JSONField(blank=True, default=dict)
|
||||
|
||||
|
||||
@register_cell_class
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import django.db.models.deletion
|
||||
import jsonfield.fields
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ class Migration(migrations.Migration):
|
|||
'id',
|
||||
models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
('subscription_info', jsonfield.fields.JSONField(default=dict)),
|
||||
('subscription_info', JSONField(default=dict)),
|
||||
('creation_timestamp', models.DateTimeField(auto_now_add=True)),
|
||||
(
|
||||
'user',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Generated by Django 1.11.12 on 2019-06-28 08:42
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -23,6 +23,6 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='pwasettings',
|
||||
name='push_notifications_infos',
|
||||
field=jsonfield.fields.JSONField(blank=True, default=dict),
|
||||
field=JSONField(blank=True, default=dict),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -21,6 +21,7 @@ import json
|
|||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.core import serializers
|
||||
from django.core.files.base import ContentFile
|
||||
from django.core.files.storage import default_storage
|
||||
|
@ -29,7 +30,6 @@ from django.utils import six
|
|||
from django.utils.encoding import force_bytes, force_text
|
||||
from django.utils.six import BytesIO
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from jsonfield import JSONField
|
||||
from py_vapid import Vapid
|
||||
|
||||
from combo import utils
|
||||
|
@ -57,7 +57,7 @@ class PwaSettings(models.Model):
|
|||
push_notifications = models.BooleanField(
|
||||
verbose_name=_('Enable subscription to push notifications'), default=False
|
||||
)
|
||||
push_notifications_infos = JSONField(blank=True)
|
||||
push_notifications_infos = JSONField(blank=True, default=dict)
|
||||
last_update_timestamp = models.DateTimeField(auto_now=True)
|
||||
|
||||
def save(self, **kwargs):
|
||||
|
@ -194,5 +194,5 @@ class PwaNavigationEntry(models.Model):
|
|||
|
||||
class PushSubscription(models.Model):
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
|
||||
subscription_info = JSONField()
|
||||
subscription_info = JSONField(default=dict)
|
||||
creation_timestamp = models.DateTimeField(auto_now_add=True)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
@ -15,6 +15,6 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='searchcell',
|
||||
name='_search_services',
|
||||
field=jsonfield.fields.JSONField(default=dict, verbose_name='Search Services', blank=True),
|
||||
field=JSONField(default=dict, verbose_name='Search Services', blank=True),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -18,6 +18,7 @@ from django import template
|
|||
from django.contrib.auth.models import Group
|
||||
from django.contrib.contenttypes import fields
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.db import models
|
||||
from django.http import HttpResponse
|
||||
|
@ -26,7 +27,6 @@ from django.template import RequestContext, Template
|
|||
from django.utils.functional import cached_property
|
||||
from django.utils.http import quote
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from jsonfield import JSONField
|
||||
|
||||
from combo.data.library import register_cell_class
|
||||
from combo.data.models import CellBase, Page
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
# 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/>.
|
||||
|
||||
import json
|
||||
|
||||
from django import forms
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
@ -119,14 +121,9 @@ class WcsFormsOfCategoryCellForm(forms.ModelForm):
|
|||
|
||||
class CategoriesSelectMultiple(forms.SelectMultiple):
|
||||
def format_value(self, value):
|
||||
# this converts data dictionary to list, for django >=1.11
|
||||
value = json.loads(value)
|
||||
return super(CategoriesSelectMultiple, self).format_value(value.get('data') or [])
|
||||
|
||||
def render_options(self, choices, value):
|
||||
# this converts data dictionary to list, for django <1.11
|
||||
value = value.get('data') or []
|
||||
return super(CategoriesSelectMultiple, self).render_options(choices, value)
|
||||
|
||||
def value_from_datadict(self, data, files, name):
|
||||
if isinstance(data, MultiValueDict):
|
||||
return {'data': data.getlist(name)}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='wcsformcell',
|
||||
name='cached_json',
|
||||
field=jsonfield.fields.JSONField(default=dict, blank=True),
|
||||
field=JSONField(default=dict, blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='wcsformsofcategorycell',
|
||||
name='manual_order',
|
||||
field=jsonfield.fields.JSONField(
|
||||
field=JSONField(
|
||||
default=dict,
|
||||
help_text='Use drag and drop to reorder forms',
|
||||
verbose_name='Manual Order',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Generated by Django 1.11.8 on 2018-01-21 12:50
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
@ -16,6 +16,6 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='wcscurrentformscell',
|
||||
name='categories',
|
||||
field=jsonfield.fields.JSONField(blank=True, default=dict, verbose_name='Categories'),
|
||||
field=JSONField(blank=True, default=dict, verbose_name='Categories'),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
@ -15,6 +15,6 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='wcscurrentdraftscell',
|
||||
name='categories',
|
||||
field=jsonfield.fields.JSONField(blank=True, default=dict, verbose_name='Categories'),
|
||||
field=JSONField(blank=True, default=dict, verbose_name='Categories'),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import django.db.models.deletion
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
import combo.apps.wcs.models
|
||||
|
@ -41,7 +41,7 @@ class Migration(migrations.Migration):
|
|||
('last_update_timestamp', models.DateTimeField(auto_now=True)),
|
||||
('carddef_reference', models.CharField(max_length=150, verbose_name='Card Model')),
|
||||
('cached_title', models.CharField(max_length=150, verbose_name='Title')),
|
||||
('cached_json', jsonfield.fields.JSONField(blank=True, default=dict)),
|
||||
('cached_json', JSONField(blank=True, default=dict)),
|
||||
('groups', models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Groups')),
|
||||
('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.Page')),
|
||||
],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
@ -15,6 +15,6 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='backofficesubmissioncell',
|
||||
name='categories',
|
||||
field=jsonfield.fields.JSONField(blank=True, default=dict, verbose_name='Categories'),
|
||||
field=JSONField(blank=True, default=dict, verbose_name='Categories'),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
@ -12,6 +12,6 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='wcscareformscell',
|
||||
name='categories',
|
||||
field=jsonfield.fields.JSONField(blank=True, default=dict, verbose_name='Categories'),
|
||||
field=JSONField(blank=True, default=dict, verbose_name='Categories'),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -21,12 +21,12 @@ import copy
|
|||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import models
|
||||
from django.forms import Select
|
||||
from django.forms import models as model_forms
|
||||
from django.utils.text import slugify
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from jsonfield import JSONField
|
||||
from requests.exceptions import RequestException
|
||||
|
||||
from combo import utils
|
||||
|
@ -66,7 +66,7 @@ class WcsFormCell(CellBase):
|
|||
|
||||
cached_title = models.CharField(_('Title'), max_length=150)
|
||||
cached_url = models.URLField(_('URL'))
|
||||
cached_json = JSONField(blank=True)
|
||||
cached_json = JSONField(blank=True, default=dict)
|
||||
|
||||
template_name = 'combo/wcs/form.html'
|
||||
add_as_link_label = _('add a form link')
|
||||
|
@ -454,7 +454,7 @@ class CategoriesFilteringMixin(object):
|
|||
class WcsCurrentFormsCell(CategoriesValidityMixin, CategoriesFilteringMixin, WcsUserDataBaseCell):
|
||||
variable_name = 'user_forms'
|
||||
|
||||
categories = JSONField(_('Categories'), blank=True)
|
||||
categories = JSONField(_('Categories'), blank=True, default=dict)
|
||||
current_forms = models.BooleanField(_('Current Forms'), default=True)
|
||||
done_forms = models.BooleanField(_('Done Forms'), default=False)
|
||||
include_drafts = models.BooleanField(_('Include drafts'), default=False)
|
||||
|
@ -545,7 +545,7 @@ class WcsCurrentDraftsCell(CategoriesValidityMixin, CategoriesFilteringMixin, Wc
|
|||
variable_name = 'current_drafts'
|
||||
template_name = 'combo/wcs/current_drafts.html'
|
||||
|
||||
categories = JSONField(_('Categories'), blank=True)
|
||||
categories = JSONField(_('Categories'), blank=True, default=dict)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Current Drafts')
|
||||
|
@ -600,7 +600,10 @@ class WcsFormsOfCategoryCell(WcsCommonCategoryCell, WcsBlurpMixin):
|
|||
],
|
||||
)
|
||||
manual_order = JSONField(
|
||||
blank=True, verbose_name=_('Manual Order'), help_text=_('Use drag and drop to reorder forms')
|
||||
blank=True,
|
||||
default=dict,
|
||||
verbose_name=_('Manual Order'),
|
||||
help_text=_('Use drag and drop to reorder forms'),
|
||||
)
|
||||
limit = models.PositiveSmallIntegerField(_('Limit'), null=True, blank=True)
|
||||
|
||||
|
@ -709,7 +712,7 @@ class WcsFormsOfCategoryCell(WcsCommonCategoryCell, WcsBlurpMixin):
|
|||
|
||||
@register_cell_class
|
||||
class WcsCareFormsCell(CategoriesValidityMixin, CategoriesFilteringMixin, WcsDataBaseCell):
|
||||
categories = JSONField(_('Categories'), blank=True)
|
||||
categories = JSONField(_('Categories'), blank=True, default=dict)
|
||||
|
||||
api_url = '/api/forms/?limit=10'
|
||||
variable_name = 'care_forms'
|
||||
|
@ -889,7 +892,7 @@ class WcsCardInfosCell(CardMixin, CellBase):
|
|||
without_user = models.BooleanField(_('Ignore the logged-in user'), default=False)
|
||||
|
||||
cached_title = models.CharField(_('Title'), max_length=150)
|
||||
cached_json = JSONField(blank=True)
|
||||
cached_json = JSONField(blank=True, default=dict)
|
||||
|
||||
is_enabled = classmethod(is_wcs_enabled)
|
||||
|
||||
|
@ -1027,7 +1030,7 @@ class BackofficeSubmissionCell(CategoriesValidityMixin, CategoriesFilteringMixin
|
|||
cache_duration = 600
|
||||
user_dependant = True
|
||||
|
||||
categories = JSONField(_('Categories'), blank=True)
|
||||
categories = JSONField(_('Categories'), blank=True, default=dict)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Backoffice Submission')
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from django.apps import apps
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.db import connection
|
||||
from jsonfield import JSONField
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ class Migration(migrations.Migration):
|
|||
('empty_label', models.CharField(default=b'---', max_length=64, verbose_name='Empty label')),
|
||||
(
|
||||
'parameters',
|
||||
jsonfield.fields.JSONField(
|
||||
JSONField(
|
||||
default=dict,
|
||||
help_text='Must be a JSON list, containing dictionaries with 3 keys: name, value and optionnally roles; name must be a string, value must be a dictionary and roles must a list of role names. Role names limit the visibility of the choice.',
|
||||
verbose_name='Parameters',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
('last_update_timestamp', models.DateTimeField(auto_now=True)),
|
||||
('key', models.CharField(max_length=50)),
|
||||
('parameters', jsonfield.fields.JSONField(default=dict, blank=True)),
|
||||
('parameters', JSONField(default=dict, blank=True)),
|
||||
('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)),
|
||||
('page', models.ForeignKey(to='data.Page', on_delete=models.CASCADE)),
|
||||
],
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import django.db.models.deletion
|
||||
import jsonfield.fields
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||
('comment', models.TextField(blank=True, null=True)),
|
||||
('serialization', jsonfield.fields.JSONField(blank=True, default=dict)),
|
||||
('serialization', JSONField(blank=True, default=dict)),
|
||||
(
|
||||
'page',
|
||||
models.ForeignKey(
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Generated by Django 1.11.12 on 2018-06-02 11:03
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import jsonfield.fields
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
@ -16,6 +16,6 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='page',
|
||||
name='related_cells',
|
||||
field=jsonfield.fields.JSONField(blank=True, default=dict),
|
||||
field=JSONField(blank=True, default=dict),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -34,6 +34,7 @@ from django.contrib import messages
|
|||
from django.contrib.auth.models import Group
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.core import serializers
|
||||
from django.core.cache import cache
|
||||
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied, ValidationError
|
||||
|
@ -54,7 +55,6 @@ from django.utils.six.moves.urllib import parse as urlparse
|
|||
from django.utils.text import slugify
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from jsonfield import JSONField
|
||||
|
||||
from combo import utils
|
||||
from combo.utils import NothingInCacheException
|
||||
|
@ -209,7 +209,7 @@ class Page(models.Model):
|
|||
)
|
||||
|
||||
# keep a cached list of cell types that are used in the page.
|
||||
related_cells = JSONField(blank=True)
|
||||
related_cells = JSONField(blank=True, default=dict)
|
||||
|
||||
_level = None
|
||||
|
||||
|
@ -614,7 +614,7 @@ class PageSnapshot(models.Model):
|
|||
timestamp = models.DateTimeField(auto_now_add=True)
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True)
|
||||
comment = models.TextField(blank=True, null=True)
|
||||
serialization = JSONField(blank=True)
|
||||
serialization = JSONField(blank=True, default=dict)
|
||||
|
||||
class Meta:
|
||||
ordering = ('-timestamp',)
|
||||
|
@ -1959,7 +1959,7 @@ class ConfigJsonCell(JsonCellBase):
|
|||
objects = ConfigJsonCellManager()
|
||||
|
||||
key = models.CharField(max_length=50)
|
||||
parameters = JSONField(blank=True)
|
||||
parameters = JSONField(blank=True, default=dict)
|
||||
|
||||
@classmethod
|
||||
def get_cell_types(cls):
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
# 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/>.
|
||||
|
||||
import json
|
||||
|
||||
from django import forms
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.safestring import mark_safe
|
||||
|
@ -31,6 +33,7 @@ class MultiSortWidget(forms.SelectMultiple):
|
|||
# reorder choices to get them in the current value order
|
||||
self_choices = self.choices[:]
|
||||
choices_dict = dict(self_choices)
|
||||
value = json.loads(value)
|
||||
if value:
|
||||
for option in reversed(value.get('data')):
|
||||
if option not in choices_dict:
|
||||
|
|
|
@ -2,7 +2,6 @@ Django>=1.8, <1.12
|
|||
-e git+http://git.entrouvert.org/debian/django-ckeditor.git#egg=django_ckeditor
|
||||
gadjo
|
||||
feedparser
|
||||
django-jsonfield
|
||||
requests
|
||||
XStatic-Leaflet
|
||||
XStatic_OpenSans
|
||||
|
|
Loading…
Reference in New Issue