0001-misc-remove-django-jsonfield-dependency-52912.patch
combo/apps/dataviz/migrations/0010_auto_20190328_1111.py | ||
---|---|---|
3 | 3 |
from __future__ import unicode_literals |
4 | 4 | |
5 | 5 |
import django.db.models.deletion |
6 |
import jsonfield.fields |
|
6 |
from django.contrib.postgres.fields import JSONField |
|
7 | 7 |
from django.db import migrations, models |
8 | 8 | |
9 | 9 | |
... | ... | |
39 | 39 |
('last_update_timestamp', models.DateTimeField(auto_now=True)), |
40 | 40 |
('data_reference', models.CharField(max_length=150, verbose_name='Data')), |
41 | 41 |
('title', models.CharField(blank=True, max_length=150, verbose_name='Title')), |
42 |
('cached_json', jsonfield.fields.JSONField(blank=True, default=dict)),
|
|
42 |
('cached_json', JSONField(blank=True, default=dict)), |
|
43 | 43 |
( |
44 | 44 |
'chart_type', |
45 | 45 |
models.CharField( |
combo/apps/dataviz/migrations/0015_auto_20201202_1424.py | ||
---|---|---|
2 | 2 |
# Generated by Django 1.11.29 on 2020-12-02 13:24 |
3 | 3 |
from __future__ import unicode_literals |
4 | 4 | |
5 |
import jsonfield.fields |
|
5 |
from django.contrib.postgres.fields import JSONField |
|
6 | 6 |
from django.db import migrations |
7 | 7 | |
8 | 8 | |
... | ... | |
16 | 16 |
migrations.AddField( |
17 | 17 |
model_name='chartngcell', |
18 | 18 |
name='filter_params', |
19 |
field=jsonfield.fields.JSONField(default=dict),
|
|
19 |
field=JSONField(default=dict), |
|
20 | 20 |
), |
21 | 21 |
migrations.AddField( |
22 | 22 |
model_name='statistic', |
23 | 23 |
name='filters', |
24 |
field=jsonfield.fields.JSONField(default=list),
|
|
24 |
field=JSONField(default=list), |
|
25 | 25 |
), |
26 | 26 |
] |
combo/apps/dataviz/models.py | ||
---|---|---|
22 | 22 |
import pygal |
23 | 23 |
import pygal.util |
24 | 24 |
from django.conf import settings |
25 |
from django.contrib.postgres.fields import JSONField |
|
25 | 26 |
from django.db import models, transaction |
26 | 27 |
from django.urls import reverse |
27 | 28 |
from django.utils import timezone |
... | ... | |
29 | 30 |
from django.utils.translation import gettext |
30 | 31 |
from django.utils.translation import ugettext_lazy as _ |
31 | 32 |
from django.utils.translation import ungettext |
32 |
from jsonfield import JSONField |
|
33 | 33 |
from requests.exceptions import HTTPError, RequestException |
34 | 34 | |
35 | 35 |
from combo.data.library import register_cell_class |
combo/apps/lingo/migrations/0001_initial.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 |
import jsonfield.fields |
|
5 | 4 |
from django.conf import settings |
5 |
from django.contrib.postgres.fields import JSONField |
|
6 | 6 |
from django.db import migrations, models |
7 | 7 | |
8 | 8 | |
... | ... | |
84 | 84 |
), |
85 | 85 |
( |
86 | 86 |
'service_options', |
87 |
jsonfield.fields.JSONField( |
|
88 |
default=dict, verbose_name='Payment Service Options', blank=True |
|
89 |
), |
|
87 |
JSONField(default=dict, verbose_name='Payment Service Options', blank=True), |
|
90 | 88 |
), |
91 | 89 |
], |
92 | 90 |
options={ |
combo/apps/lingo/migrations/0002_transaction.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 |
import jsonfield.fields |
|
4 |
from django.contrib.postgres.fields import JSONField |
|
5 | 5 |
from django.db import migrations, models |
6 | 6 | |
7 | 7 | |
... | ... | |
21 | 21 |
), |
22 | 22 |
('start_date', models.DateTimeField(auto_now_add=True)), |
23 | 23 |
('end_date', models.DateTimeField(null=True)), |
24 |
('bank_data', jsonfield.fields.JSONField(default=dict, blank=True)),
|
|
24 |
('bank_data', JSONField(default=dict, blank=True)), |
|
25 | 25 |
('order_id', models.CharField(max_length=200)), |
26 | 26 |
('items', models.ManyToManyField(to='lingo.BasketItem', blank=True)), |
27 | 27 |
], |
combo/apps/lingo/migrations/0021_transactionoperation.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 |
import jsonfield.fields |
|
4 |
from django.contrib.postgres.fields import JSONField |
|
5 | 5 |
from django.db import migrations, models |
6 | 6 | |
7 | 7 | |
... | ... | |
28 | 28 |
), |
29 | 29 |
('amount', models.DecimalField(max_digits=8, decimal_places=2)), |
30 | 30 |
('creation_date', models.DateTimeField(auto_now_add=True)), |
31 |
('bank_result', jsonfield.fields.JSONField(default=dict, blank=True)),
|
|
31 |
('bank_result', JSONField(default=dict, blank=True)), |
|
32 | 32 |
('transaction', models.ForeignKey(to='lingo.Transaction', on_delete=models.CASCADE)), |
33 | 33 |
], |
34 | 34 |
), |
combo/apps/lingo/migrations/0029_auto_20170528_1334.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 |
import jsonfield.fields |
|
4 |
from django.contrib.postgres.fields import JSONField |
|
5 | 5 |
from django.db import migrations, models |
6 | 6 | |
7 | 7 | |
... | ... | |
24 | 24 |
migrations.AddField( |
25 | 25 |
model_name='basketitem', |
26 | 26 |
name='request_data', |
27 |
field=jsonfield.fields.JSONField(default=dict, blank=True),
|
|
27 |
field=JSONField(default=dict, blank=True), |
|
28 | 28 |
), |
29 | 29 |
migrations.AddField( |
30 | 30 |
model_name='regie', |
combo/apps/lingo/migrations/0034_auto_20190426_1159.py | ||
---|---|---|
3 | 3 |
from __future__ import unicode_literals |
4 | 4 | |
5 | 5 |
import django.db.models.deletion |
6 |
import jsonfield.fields |
|
6 |
from django.contrib.postgres.fields import JSONField |
|
7 | 7 |
from django.db import migrations, models |
8 | 8 | |
9 | 9 | |
... | ... | |
50 | 50 |
), |
51 | 51 |
( |
52 | 52 |
'service_options', |
53 |
jsonfield.fields.JSONField( |
|
54 |
blank=True, default=dict, verbose_name='Payment Service Options' |
|
55 |
), |
|
53 |
JSONField(blank=True, default=dict, verbose_name='Payment Service Options'), |
|
56 | 54 |
), |
57 | 55 |
], |
58 | 56 |
), |
combo/apps/lingo/migrations/0037_regie_transaction_options.py | ||
---|---|---|
2 | 2 |
# Generated by Django 1.11.18 on 2019-05-14 12:02 |
3 | 3 |
from __future__ import unicode_literals |
4 | 4 | |
5 |
import jsonfield.fields |
|
5 |
from django.contrib.postgres.fields import JSONField |
|
6 | 6 |
from django.db import migrations, models |
7 | 7 | |
8 | 8 |
from combo.apps.lingo.models import SERVICES |
... | ... | |
18 | 18 |
migrations.AddField( |
19 | 19 |
model_name='regie', |
20 | 20 |
name='transaction_options', |
21 |
field=jsonfield.fields.JSONField(blank=True, default=dict, verbose_name='Transaction Options'),
|
|
21 |
field=JSONField(blank=True, default=dict, verbose_name='Transaction Options'), |
|
22 | 22 |
), |
23 | 23 |
migrations.AlterField( |
24 | 24 |
model_name='paymentbackend', |
combo/apps/lingo/models.py | ||
---|---|---|
27 | 27 |
from django import template |
28 | 28 |
from django.conf import settings |
29 | 29 |
from django.contrib.auth.models import User |
30 |
from django.contrib.postgres.fields import JSONField |
|
30 | 31 |
from django.core import serializers |
31 | 32 |
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied, ValidationError |
32 | 33 |
from django.core.mail import EmailMultiAlternatives |
... | ... | |
42 | 43 |
from django.utils.six.moves.urllib import parse as urlparse |
43 | 44 |
from django.utils.timezone import make_aware, utc |
44 | 45 |
from django.utils.translation import ugettext_lazy as _ |
45 |
from jsonfield import JSONField |
|
46 | 46 |
from requests import RequestException |
47 | 47 | |
48 | 48 |
from combo.apps.notifications.models import Notification |
... | ... | |
118 | 118 |
unique=True, verbose_name=_('Identifier'), help_text=_('The identifier is used in webservice calls.') |
119 | 119 |
) |
120 | 120 |
service = models.CharField(verbose_name=_('Payment Service'), max_length=64, choices=SERVICES) |
121 |
service_options = JSONField(blank=True, verbose_name=_('Payment Service Options')) |
|
121 |
service_options = JSONField(blank=True, default=dict, verbose_name=_('Payment Service Options'))
|
|
122 | 122 | |
123 | 123 |
objects = PaymentBackendManager() |
124 | 124 | |
... | ... | |
190 | 190 |
payment_backend = models.ForeignKey( |
191 | 191 |
PaymentBackend, on_delete=models.CASCADE, verbose_name=_('Payment backend') |
192 | 192 |
) |
193 |
transaction_options = JSONField(blank=True, verbose_name=_('Transaction Options')) |
|
193 |
transaction_options = JSONField(blank=True, default=dict, verbose_name=_('Transaction Options'))
|
|
194 | 194 |
can_pay_only_one_basket_item = models.BooleanField( |
195 | 195 |
default=True, verbose_name=_('Basket items must be paid individually') |
196 | 196 |
) |
... | ... | |
486 | 486 |
source_url = models.URLField(_('Source URL'), blank=True) |
487 | 487 |
details = models.TextField(verbose_name=_('Details'), blank=True) |
488 | 488 |
amount = models.DecimalField(verbose_name=_('Amount'), decimal_places=2, max_digits=8) |
489 |
request_data = JSONField(blank=True) |
|
489 |
request_data = JSONField(blank=True, default=dict)
|
|
490 | 490 |
extra_fee = models.BooleanField(default=False) |
491 | 491 |
user_cancellable = models.BooleanField(default=True) |
492 | 492 |
creation_date = models.DateTimeField(auto_now_add=True) |
... | ... | |
611 | 611 |
to_be_paid_remote_items = models.CharField(max_length=512, null=True) |
612 | 612 |
start_date = models.DateTimeField(auto_now_add=True) |
613 | 613 |
end_date = models.DateTimeField(null=True) |
614 |
bank_data = JSONField(blank=True) |
|
614 |
bank_data = JSONField(blank=True, default=dict)
|
|
615 | 615 |
order_id = models.CharField(max_length=200) |
616 | 616 |
bank_transaction_id = models.CharField(max_length=200, null=True) |
617 | 617 |
bank_transaction_date = models.DateTimeField(blank=True, null=True) |
... | ... | |
703 | 703 |
kind = models.CharField(max_length=65, choices=OPERATIONS) |
704 | 704 |
amount = models.DecimalField(decimal_places=2, max_digits=8) |
705 | 705 |
creation_date = models.DateTimeField(auto_now_add=True) |
706 |
bank_result = JSONField(blank=True) |
|
706 |
bank_result = JSONField(blank=True, default=dict)
|
|
707 | 707 | |
708 | 708 | |
709 | 709 |
@register_cell_class |
combo/apps/pwa/migrations/0001_initial.py | ||
---|---|---|
3 | 3 |
from __future__ import unicode_literals |
4 | 4 | |
5 | 5 |
import django.db.models.deletion |
6 |
import jsonfield.fields |
|
7 | 6 |
from django.conf import settings |
7 |
from django.contrib.postgres.fields import JSONField |
|
8 | 8 |
from django.db import migrations, models |
9 | 9 | |
10 | 10 | |
... | ... | |
24 | 24 |
'id', |
25 | 25 |
models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), |
26 | 26 |
), |
27 |
('subscription_info', jsonfield.fields.JSONField(default=dict)),
|
|
27 |
('subscription_info', JSONField(default=dict)), |
|
28 | 28 |
('creation_timestamp', models.DateTimeField(auto_now_add=True)), |
29 | 29 |
( |
30 | 30 |
'user', |
combo/apps/pwa/migrations/0006_auto_20190628_1042.py | ||
---|---|---|
2 | 2 |
# Generated by Django 1.11.12 on 2019-06-28 08:42 |
3 | 3 |
from __future__ import unicode_literals |
4 | 4 | |
5 |
import jsonfield.fields |
|
5 |
from django.contrib.postgres.fields import JSONField |
|
6 | 6 |
from django.db import migrations, models |
7 | 7 | |
8 | 8 | |
... | ... | |
23 | 23 |
migrations.AddField( |
24 | 24 |
model_name='pwasettings', |
25 | 25 |
name='push_notifications_infos', |
26 |
field=jsonfield.fields.JSONField(blank=True, default=dict),
|
|
26 |
field=JSONField(blank=True, default=dict), |
|
27 | 27 |
), |
28 | 28 |
] |
combo/apps/pwa/models.py | ||
---|---|---|
20 | 20 |
import json |
21 | 21 | |
22 | 22 |
from django.conf import settings |
23 |
from django.contrib.postgres.fields import JSONField |
|
23 | 24 |
from django.core import serializers |
24 | 25 |
from django.core.files.base import ContentFile |
25 | 26 |
from django.core.files.storage import default_storage |
... | ... | |
28 | 29 |
from django.utils.encoding import force_bytes, force_text |
29 | 30 |
from django.utils.six import BytesIO |
30 | 31 |
from django.utils.translation import ugettext_lazy as _ |
31 |
from jsonfield import JSONField |
|
32 | 32 |
from py_vapid import Vapid |
33 | 33 | |
34 | 34 |
from combo import utils |
... | ... | |
56 | 56 |
push_notifications = models.BooleanField( |
57 | 57 |
verbose_name=_('Enable subscription to push notifications'), default=False |
58 | 58 |
) |
59 |
push_notifications_infos = JSONField(blank=True) |
|
59 |
push_notifications_infos = JSONField(blank=True, default=dict)
|
|
60 | 60 |
last_update_timestamp = models.DateTimeField(auto_now=True) |
61 | 61 | |
62 | 62 |
def save(self, **kwargs): |
... | ... | |
193 | 193 | |
194 | 194 |
class PushSubscription(models.Model): |
195 | 195 |
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) |
196 |
subscription_info = JSONField() |
|
196 |
subscription_info = JSONField(default=dict)
|
|
197 | 197 |
creation_timestamp = models.DateTimeField(auto_now_add=True) |
combo/apps/search/migrations/0002_auto_20180720_1511.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 |
import jsonfield.fields |
|
4 |
from django.contrib.postgres.fields import JSONField |
|
5 | 5 |
from django.db import migrations |
6 | 6 | |
7 | 7 | |
... | ... | |
15 | 15 |
migrations.AddField( |
16 | 16 |
model_name='searchcell', |
17 | 17 |
name='_search_services', |
18 |
field=jsonfield.fields.JSONField(default=dict, verbose_name='Search Services', blank=True),
|
|
18 |
field=JSONField(default=dict, verbose_name='Search Services', blank=True), |
|
19 | 19 |
), |
20 | 20 |
] |
combo/apps/search/models.py | ||
---|---|---|
18 | 18 |
from django.contrib.auth.models import Group |
19 | 19 |
from django.contrib.contenttypes import fields |
20 | 20 |
from django.contrib.contenttypes.models import ContentType |
21 |
from django.contrib.postgres.fields import JSONField |
|
21 | 22 |
from django.core.exceptions import PermissionDenied |
22 | 23 |
from django.db import models |
23 | 24 |
from django.http import HttpResponse |
... | ... | |
26 | 27 |
from django.utils.functional import cached_property |
27 | 28 |
from django.utils.http import quote |
28 | 29 |
from django.utils.translation import ugettext_lazy as _ |
29 |
from jsonfield import JSONField |
|
30 | 30 | |
31 | 31 |
from combo.data.library import register_cell_class |
32 | 32 |
from combo.data.models import CellBase, Page |
combo/apps/wcs/forms.py | ||
---|---|---|
14 | 14 |
# You should have received a copy of the GNU Affero General Public License |
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 |
import json |
|
18 | ||
17 | 19 |
from django import forms |
18 | 20 |
from django.utils.datastructures import MultiValueDict |
19 | 21 |
from django.utils.translation import ugettext_lazy as _ |
... | ... | |
96 | 98 | |
97 | 99 |
class CategoriesSelectMultiple(forms.SelectMultiple): |
98 | 100 |
def format_value(self, value): |
99 |
# this converts data dictionary to list, for django >=1.11
|
|
101 |
value = json.loads(value)
|
|
100 | 102 |
return super(CategoriesSelectMultiple, self).format_value(value.get('data') or []) |
101 | 103 | |
102 |
def render_options(self, choices, value): |
|
103 |
# this converts data dictionary to list, for django <1.11 |
|
104 |
value = value.get('data') or [] |
|
105 |
return super(CategoriesSelectMultiple, self).render_options(choices, value) |
|
106 | ||
107 | 104 |
def value_from_datadict(self, data, files, name): |
108 | 105 |
if isinstance(data, MultiValueDict): |
109 | 106 |
return {'data': data.getlist(name)} |
combo/apps/wcs/migrations/0008_wcsformcell_cached_json.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 |
import jsonfield.fields |
|
4 |
from django.contrib.postgres.fields import JSONField |
|
5 | 5 |
from django.db import migrations, models |
6 | 6 | |
7 | 7 | |
... | ... | |
15 | 15 |
migrations.AddField( |
16 | 16 |
model_name='wcsformcell', |
17 | 17 |
name='cached_json', |
18 |
field=jsonfield.fields.JSONField(default=dict, blank=True),
|
|
18 |
field=JSONField(default=dict, blank=True), |
|
19 | 19 |
preserve_default=True, |
20 | 20 |
), |
21 | 21 |
] |
combo/apps/wcs/migrations/0012_wcsformsofcategorycell_manual_order.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 |
import jsonfield.fields |
|
4 |
from django.contrib.postgres.fields import JSONField |
|
5 | 5 |
from django.db import migrations, models |
6 | 6 | |
7 | 7 | |
... | ... | |
15 | 15 |
migrations.AddField( |
16 | 16 |
model_name='wcsformsofcategorycell', |
17 | 17 |
name='manual_order', |
18 |
field=jsonfield.fields.JSONField(
|
|
18 |
field=JSONField( |
|
19 | 19 |
default=dict, |
20 | 20 |
help_text='Use drag and drop to reorder forms', |
21 | 21 |
verbose_name='Manual Order', |
combo/apps/wcs/migrations/0015_wcscurrentformscell_categories.py | ||
---|---|---|
2 | 2 |
# Generated by Django 1.11.8 on 2018-01-21 12:50 |
3 | 3 |
from __future__ import unicode_literals |
4 | 4 | |
5 |
import jsonfield.fields |
|
5 |
from django.contrib.postgres.fields import JSONField |
|
6 | 6 |
from django.db import migrations |
7 | 7 | |
8 | 8 | |
... | ... | |
16 | 16 |
migrations.AddField( |
17 | 17 |
model_name='wcscurrentformscell', |
18 | 18 |
name='categories', |
19 |
field=jsonfield.fields.JSONField(blank=True, default=dict, verbose_name='Categories'),
|
|
19 |
field=JSONField(blank=True, default=dict, verbose_name='Categories'), |
|
20 | 20 |
), |
21 | 21 |
] |
combo/apps/wcs/migrations/0018_wcscurrentdraftscell_categories.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 |
import jsonfield.fields |
|
4 |
from django.contrib.postgres.fields import JSONField |
|
5 | 5 |
from django.db import migrations |
6 | 6 | |
7 | 7 | |
... | ... | |
15 | 15 |
migrations.AddField( |
16 | 16 |
model_name='wcscurrentdraftscell', |
17 | 17 |
name='categories', |
18 |
field=jsonfield.fields.JSONField(blank=True, default=dict, verbose_name='Categories'),
|
|
18 |
field=JSONField(blank=True, default=dict, verbose_name='Categories'), |
|
19 | 19 |
), |
20 | 20 |
] |
combo/apps/wcs/migrations/0021_card.py | ||
---|---|---|
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 | 4 |
import django.db.models.deletion |
5 |
import jsonfield.fields |
|
5 |
from django.contrib.postgres.fields import JSONField |
|
6 | 6 |
from django.db import migrations, models |
7 | 7 | |
8 | 8 |
import combo.apps.wcs.models |
... | ... | |
41 | 41 |
('last_update_timestamp', models.DateTimeField(auto_now=True)), |
42 | 42 |
('carddef_reference', models.CharField(max_length=150, verbose_name='Card Model')), |
43 | 43 |
('cached_title', models.CharField(max_length=150, verbose_name='Title')), |
44 |
('cached_json', jsonfield.fields.JSONField(blank=True, default=dict)),
|
|
44 |
('cached_json', JSONField(blank=True, default=dict)), |
|
45 | 45 |
('groups', models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Groups')), |
46 | 46 |
('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.Page')), |
47 | 47 |
], |
combo/apps/wcs/migrations/0025_submission_categories.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 |
import jsonfield.fields |
|
4 |
from django.contrib.postgres.fields import JSONField |
|
5 | 5 |
from django.db import migrations |
6 | 6 | |
7 | 7 | |
... | ... | |
15 | 15 |
migrations.AddField( |
16 | 16 |
model_name='backofficesubmissioncell', |
17 | 17 |
name='categories', |
18 |
field=jsonfield.fields.JSONField(blank=True, default=dict, verbose_name='Categories'),
|
|
18 |
field=JSONField(blank=True, default=dict, verbose_name='Categories'), |
|
19 | 19 |
), |
20 | 20 |
] |
combo/apps/wcs/models.py | ||
---|---|---|
20 | 20 |
import logging |
21 | 21 | |
22 | 22 |
from django.conf import settings |
23 |
from django.contrib.postgres.fields import JSONField |
|
23 | 24 |
from django.db import models |
24 | 25 |
from django.forms import Select |
25 | 26 |
from django.forms import models as model_forms |
26 | 27 |
from django.utils.text import slugify |
27 | 28 |
from django.utils.translation import ugettext_lazy as _ |
28 |
from jsonfield import JSONField |
|
29 | 29 |
from requests.exceptions import RequestException |
30 | 30 | |
31 | 31 |
from combo import utils |
... | ... | |
65 | 65 | |
66 | 66 |
cached_title = models.CharField(_('Title'), max_length=150) |
67 | 67 |
cached_url = models.URLField(_('URL')) |
68 |
cached_json = JSONField(blank=True) |
|
68 |
cached_json = JSONField(blank=True, default=dict)
|
|
69 | 69 | |
70 | 70 |
template_name = 'combo/wcs/form.html' |
71 | 71 |
add_as_link_label = _('add a form link') |
... | ... | |
425 | 425 |
class WcsCurrentFormsCell(WcsUserDataBaseCell, CategoriesValidityMixin): |
426 | 426 |
variable_name = 'user_forms' |
427 | 427 | |
428 |
categories = JSONField(_('Categories'), blank=True) |
|
428 |
categories = JSONField(_('Categories'), blank=True, default=dict)
|
|
429 | 429 |
current_forms = models.BooleanField(_('Current Forms'), default=True) |
430 | 430 |
done_forms = models.BooleanField(_('Done Forms'), default=False) |
431 | 431 |
include_drafts = models.BooleanField(_('Include drafts'), default=False) |
... | ... | |
523 | 523 |
variable_name = 'current_drafts' |
524 | 524 |
template_name = 'combo/wcs/current_drafts.html' |
525 | 525 | |
526 |
categories = JSONField(_('Categories'), blank=True) |
|
526 |
categories = JSONField(_('Categories'), blank=True, default=dict)
|
|
527 | 527 | |
528 | 528 |
class Meta: |
529 | 529 |
verbose_name = _('Current Drafts') |
... | ... | |
585 | 585 |
], |
586 | 586 |
) |
587 | 587 |
manual_order = JSONField( |
588 |
blank=True, verbose_name=_('Manual Order'), help_text=_('Use drag and drop to reorder forms') |
|
588 |
blank=True, |
|
589 |
default=dict, |
|
590 |
verbose_name=_('Manual Order'), |
|
591 |
help_text=_('Use drag and drop to reorder forms'), |
|
589 | 592 |
) |
590 | 593 |
limit = models.PositiveSmallIntegerField(_('Limit'), null=True, blank=True) |
591 | 594 | |
... | ... | |
852 | 855 |
without_user = models.BooleanField(_('Ignore the logged-in user'), default=False) |
853 | 856 | |
854 | 857 |
cached_title = models.CharField(_('Title'), max_length=150) |
855 |
cached_json = JSONField(blank=True) |
|
858 |
cached_json = JSONField(blank=True, default=dict)
|
|
856 | 859 | |
857 | 860 |
is_enabled = classmethod(is_wcs_enabled) |
858 | 861 | |
... | ... | |
982 | 985 |
cache_duration = 600 |
983 | 986 |
user_dependant = True |
984 | 987 | |
985 |
categories = JSONField(_('Categories'), blank=True) |
|
988 |
categories = JSONField(_('Categories'), blank=True, default=dict)
|
|
986 | 989 | |
987 | 990 |
class Meta: |
988 | 991 |
verbose_name = _('Backoffice Submission') |
combo/data/migrations/0013_parameterscell.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 |
import jsonfield.fields |
|
4 |
from django.contrib.postgres.fields import JSONField |
|
5 | 5 |
from django.db import migrations, models |
6 | 6 | |
7 | 7 | |
... | ... | |
33 | 33 |
('empty_label', models.CharField(default=b'---', max_length=64, verbose_name='Empty label')), |
34 | 34 |
( |
35 | 35 |
'parameters', |
36 |
jsonfield.fields.JSONField(
|
|
36 |
JSONField( |
|
37 | 37 |
default=dict, |
38 | 38 |
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.', |
39 | 39 |
verbose_name='Parameters', |
combo/data/migrations/0024_configjsoncell.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
from __future__ import unicode_literals |
3 | 3 | |
4 |
import jsonfield.fields |
|
4 |
from django.contrib.postgres.fields import JSONField |
|
5 | 5 |
from django.db import migrations, models |
6 | 6 | |
7 | 7 | |
... | ... | |
36 | 36 |
), |
37 | 37 |
('last_update_timestamp', models.DateTimeField(auto_now=True)), |
38 | 38 |
('key', models.CharField(max_length=50)), |
39 |
('parameters', jsonfield.fields.JSONField(default=dict, blank=True)),
|
|
39 |
('parameters', JSONField(default=dict, blank=True)), |
|
40 | 40 |
('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)), |
41 | 41 |
('page', models.ForeignKey(to='data.Page', on_delete=models.CASCADE)), |
42 | 42 |
], |
combo/data/migrations/0033_auto_20180401_1300.py | ||
---|---|---|
3 | 3 |
from __future__ import unicode_literals |
4 | 4 | |
5 | 5 |
import django.db.models.deletion |
6 |
import jsonfield.fields |
|
7 | 6 |
from django.conf import settings |
7 |
from django.contrib.postgres.fields import JSONField |
|
8 | 8 |
from django.db import migrations, models |
9 | 9 | |
10 | 10 | |
... | ... | |
25 | 25 |
), |
26 | 26 |
('timestamp', models.DateTimeField(auto_now_add=True)), |
27 | 27 |
('comment', models.TextField(blank=True, null=True)), |
28 |
('serialization', jsonfield.fields.JSONField(blank=True, default=dict)),
|
|
28 |
('serialization', JSONField(blank=True, default=dict)), |
|
29 | 29 |
( |
30 | 30 |
'page', |
31 | 31 |
models.ForeignKey( |
combo/data/migrations/0035_page_related_cells.py | ||
---|---|---|
2 | 2 |
# Generated by Django 1.11.12 on 2018-06-02 11:03 |
3 | 3 |
from __future__ import unicode_literals |
4 | 4 | |
5 |
import jsonfield.fields |
|
5 |
from django.contrib.postgres.fields import JSONField |
|
6 | 6 |
from django.db import migrations |
7 | 7 | |
8 | 8 | |
... | ... | |
16 | 16 |
migrations.AddField( |
17 | 17 |
model_name='page', |
18 | 18 |
name='related_cells', |
19 |
field=jsonfield.fields.JSONField(blank=True, default=dict),
|
|
19 |
field=JSONField(blank=True, default=dict), |
|
20 | 20 |
), |
21 | 21 |
] |
combo/data/models.py | ||
---|---|---|
34 | 34 |
from django.contrib.auth.models import Group |
35 | 35 |
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation |
36 | 36 |
from django.contrib.contenttypes.models import ContentType |
37 |
from django.contrib.postgres.fields import JSONField |
|
37 | 38 |
from django.core import serializers |
38 | 39 |
from django.core.cache import cache |
39 | 40 |
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied, ValidationError |
... | ... | |
54 | 55 |
from django.utils.text import slugify |
55 | 56 |
from django.utils.timezone import now |
56 | 57 |
from django.utils.translation import ugettext_lazy as _ |
57 |
from jsonfield import JSONField |
|
58 | 58 | |
59 | 59 |
from combo import utils |
60 | 60 |
from combo.utils import NothingInCacheException |
... | ... | |
209 | 209 |
) |
210 | 210 | |
211 | 211 |
# keep a cached list of cell types that are used in the page. |
212 |
related_cells = JSONField(blank=True) |
|
212 |
related_cells = JSONField(blank=True, default=dict)
|
|
213 | 213 | |
214 | 214 |
_level = None |
215 | 215 | |
... | ... | |
614 | 614 |
timestamp = models.DateTimeField(auto_now_add=True) |
615 | 615 |
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True) |
616 | 616 |
comment = models.TextField(blank=True, null=True) |
617 |
serialization = JSONField(blank=True) |
|
617 |
serialization = JSONField(blank=True, default=dict)
|
|
618 | 618 | |
619 | 619 |
class Meta: |
620 | 620 |
ordering = ('-timestamp',) |
... | ... | |
1948 | 1948 |
objects = ConfigJsonCellManager() |
1949 | 1949 | |
1950 | 1950 |
key = models.CharField(max_length=50) |
1951 |
parameters = JSONField(blank=True) |
|
1951 |
parameters = JSONField(blank=True, default=dict)
|
|
1952 | 1952 | |
1953 | 1953 |
@classmethod |
1954 | 1954 |
def get_cell_types(cls): |
combo/utils/forms.py | ||
---|---|---|
14 | 14 |
# You should have received a copy of the GNU Affero General Public License |
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 |
import json |
|
18 | ||
17 | 19 |
from django import forms |
18 | 20 |
from django.utils.datastructures import MultiValueDict |
19 | 21 |
from django.utils.safestring import mark_safe |
... | ... | |
31 | 33 |
# reorder choices to get them in the current value order |
32 | 34 |
self_choices = self.choices[:] |
33 | 35 |
choices_dict = dict(self_choices) |
36 |
value = json.loads(value) |
|
34 | 37 |
if value: |
35 | 38 |
for option in reversed(value.get('data')): |
36 | 39 |
if option not in choices_dict: |
requirements.txt | ||
---|---|---|
2 | 2 |
-e git+http://git.entrouvert.org/debian/django-ckeditor.git#egg=django_ckeditor |
3 | 3 |
gadjo |
4 | 4 |
feedparser |
5 |
django-jsonfield |
|
6 | 5 |
requests |
7 | 6 |
XStatic-Leaflet |
8 | 7 |
XStatic_OpenSans |
setup.py | ||
---|---|---|
164 | 164 |
'django-ckeditor<4.5.4', |
165 | 165 |
'gadjo>=0.53', |
166 | 166 |
'feedparser<6' if sys.version_info < (3, 9) else 'feedparser>=6', |
167 |
'django-jsonfield', |
|
168 | 167 |
'requests', |
169 | 168 |
'XStatic-Leaflet', |
170 | 169 |
'XStatic-Leaflet-GestureHandling', |
tests/test_wcs.py | ||
---|---|---|
1065 | 1065 |
assert resp.status_int == 302 |
1066 | 1066 | |
1067 | 1067 | |
1068 |
def test_manager_current_forms(app, admin_user): |
|
1068 |
@mock.patch('combo.apps.wcs.utils.requests.send', side_effect=mocked_requests_send) |
|
1069 |
def test_manager_current_forms(mock_send, app, admin_user): |
|
1069 | 1070 |
page = Page(title='One', slug='one', template_name='standard') |
1070 | 1071 |
page.save() |
1071 | 1072 |
app = login(app) |
1072 |
- |