Skip to content

Commit

Permalink
Merge pull request #3090 from centerofci/3089-remove-redundant-reques…
Browse files Browse the repository at this point in the history
…t-body-content-types

Updated Django REST Framework settings to use JSONParser as the default parser for incoming requests
  • Loading branch information
mathemancer committed Nov 16, 2023
2 parents f8eca23 + 215eb81 commit de4eeef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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

0 comments on commit de4eeef

Please sign in to comment.