Skip to content
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

Updated Django REST Framework settings to use JSONParser as the default parser for incoming requests #3090

Merged
merged 11 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/settings/common_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ def pipe_delim(pipe_string):
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated',
],
'DEFAULT_PARSER_CLASSES': [
'rest_framework.parsers.JSONParser',
],
'DEFAULT_FILTER_BACKENDS': (
'django_filters.rest_framework.DjangoFilterBackend',
'rest_framework.filters.OrderingFilter',
Expand Down
2 changes: 2 additions & 0 deletions mathesar/api/db/viewsets/data_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from rest_framework import status, viewsets
from rest_framework.mixins import CreateModelMixin, ListModelMixin, RetrieveModelMixin
from rest_framework.response import Response
from rest_framework.parsers import MultiPartParser, JSONParser

from mathesar.api.dj_filters import DataFileFilter
import mathesar.api.exceptions.data_import_exceptions.exceptions
Expand All @@ -21,6 +22,7 @@ class DataFileViewSet(viewsets.GenericViewSet, ListModelMixin, RetrieveModelMixi
pagination_class = DefaultLimitOffsetPagination
filter_backends = (filters.DjangoFilterBackend,)
filterset_class = DataFileFilter
parser_classes = [MultiPartParser, JSONParser]

def partial_update(self, request, pk=None):
serializer = DataFileSerializer(
Expand Down