Skip to content

Commit b4abcad

Browse files
committed
Revert "Django3: remove old non-JSONFields and kept the new ones only"
This reverts commit ff6184b.
1 parent 7268351 commit b4abcad

File tree

5 files changed

+10
-70
lines changed

5 files changed

+10
-70
lines changed

readthedocs/builds/migrations/0039_remove_old_jsonfields.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

readthedocs/builds/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
ModificationDateTimeField,
2020
)
2121
from django_extensions.db.models import TimeStampedModel
22+
from jsonfield import JSONField
2223
from polymorphic.models import PolymorphicModel
2324

2425
import readthedocs.builds.automation_actions as actions
@@ -661,7 +662,8 @@ class Build(models.Model):
661662
null=True,
662663
blank=True,
663664
)
664-
_config = models.JSONField(_('Configuration used in the build'), default=dict)
665+
_config = JSONField(_('Configuration used in the build'), default=dict)
666+
_config_json = models.JSONField(_('Configuration used in the build'), default=dict)
665667

666668
length = models.IntegerField(_('Build Length'), null=True, blank=True)
667669

readthedocs/integrations/migrations/0009_remove_old_jsonfields.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

readthedocs/integrations/models.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from django.db import models, transaction
1313
from django.utils.safestring import mark_safe
1414
from django.utils.translation import gettext_lazy as _
15+
from jsonfield import JSONField
1516
from pygments import highlight
1617
from pygments.formatters import HtmlFormatter
1718
from pygments.lexers import JsonLexer
@@ -143,15 +144,17 @@ class HttpExchange(models.Model):
143144

144145
date = models.DateTimeField(_('Date'), auto_now_add=True)
145146

146-
request_headers = models.JSONField(
147+
request_headers = JSONField(_('Request headers'))
148+
request_headers_json = models.JSONField(
147149
_('Request headers'),
148150
# Delete after deploy
149151
null=True,
150152
default=None,
151153
)
152154
request_body = models.TextField(_('Request body'))
153155

154-
response_headers = models.JSONField(
156+
response_headers = JSONField(_('Request headers'))
157+
response_headers_json = models.JSONField(
155158
_('Request headers'),
156159
# Delete after deploy
157160
null=True,
@@ -295,7 +298,8 @@ class Integration(models.Model):
295298
max_length=32,
296299
choices=INTEGRATIONS,
297300
)
298-
provider_data = models.JSONField(_('Provider data'), default=dict)
301+
provider_data = JSONField(_('Provider data'), default=dict)
302+
provider_data_json = models.JSONField(_('Provider data'), default=dict)
299303
exchanges = GenericRelation(
300304
'HttpExchange',
301305
related_query_name='integrations',

requirements/pip.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ drf-flex-fields==0.9.7
2121
drf-extensions==0.7.1
2222

2323
django-vanilla-views==3.0.0
24-
25-
# This module is only used on migrations. We are now using Django's official
26-
# JSONField. We should probably squash these migrations and remove this
27-
# dependency as well.
2824
jsonfield==3.1.0
2925

3026
requests==2.27.1

0 commit comments

Comments
 (0)