Skip to content

Apply some missing reverts from 7.2.1 release: #8958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions readthedocs/builds/migrations/0040_remove_old_jsonfields.py

This file was deleted.

1 change: 1 addition & 0 deletions readthedocs/builds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
ModificationDateTimeField,
)
from django_extensions.db.models import TimeStampedModel
from jsonfield import JSONField
from polymorphic.models import PolymorphicModel

import readthedocs.builds.automation_actions as actions
Expand Down
40 changes: 0 additions & 40 deletions readthedocs/integrations/migrations/0010_remove_old_jsonfields.py

This file was deleted.

14 changes: 7 additions & 7 deletions readthedocs/integrations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from django.db import models, transaction
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
from jsonfield import JSONField
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import JsonLexer
Expand Down Expand Up @@ -101,15 +102,12 @@ def from_requests_exchange(self, response, related_object):
:param related_object: Object to use for generic relationship.
"""
request = response.request
# NOTE: we need to cast ``request.headers`` and ``response.headers``
# because it's a ``requests.structures.CaseInsensitiveDict`` which is
# not JSON serializable.
obj = self.create(
related_object=related_object,
request_headers=dict(request.headers) or {},
request_headers=request.headers or {},
request_body=request.body or '',
status_code=response.status_code,
response_headers=dict(response.headers),
response_headers=response.headers,
response_body=response.text,
)
self.delete_limit(related_object)
Expand Down Expand Up @@ -146,15 +144,17 @@ class HttpExchange(models.Model):

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

request_headers = models.JSONField(
request_headers = JSONField(_('Request headers'))
request_headers_json = models.JSONField(
_('Request headers'),
# Delete after deploy
null=True,
blank=True,
)
request_body = models.TextField(_('Request body'))

response_headers = models.JSONField(
response_headers = JSONField(_('Request headers'))
response_headers_json = models.JSONField(
_('Request headers'),
# Delete after deploy
null=True,
Expand Down
4 changes: 0 additions & 4 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ drf-flex-fields==0.9.7
drf-extensions==0.7.1

django-vanilla-views==3.0.0

# This module is only used on migrations. We are now using Django's official
# JSONField. We should probably squash these migrations and remove this
# dependency as well.
jsonfield==3.1.0

requests==2.27.1
Expand Down