Python rest_framework.parsers.MultiPartParser() Examples
The following are 5
code examples of rest_framework.parsers.MultiPartParser().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
rest_framework.parsers
, or try the search function
.
Example #1
Source File: viewsets.py From OasisPlatform with BSD 3-Clause "New" or "Revised" License | 5 votes |
def parser_classes(self): if getattr(self, 'action', None) in ['set_content']: return [MultiPartParser] else: return api_settings.DEFAULT_PARSER_CLASSES
Example #2
Source File: viewsets.py From OasisPlatform with BSD 3-Clause "New" or "Revised" License | 5 votes |
def parser_classes(self): if getattr(self, 'action', None) in ['resource_file']: return [MultiPartParser] else: return api_settings.DEFAULT_PARSER_CLASSES
Example #3
Source File: viewsets.py From OasisPlatform with BSD 3-Clause "New" or "Revised" License | 5 votes |
def parser_classes(self): if getattr(self, 'action', None) in ['set_settings_file']: return [MultiPartParser] else: return api_settings.DEFAULT_PARSER_CLASSES
Example #4
Source File: viewsets.py From OasisPlatform with BSD 3-Clause "New" or "Revised" License | 5 votes |
def parser_classes(self): if getattr(self, 'action', None) in ['set_accounts_file', 'set_location_file', 'set_reinsurance_info_file', 'set_reinsurance_scope_file']: return [MultiPartParser] else: return api_settings.DEFAULT_PARSER_CLASSES
Example #5
Source File: tests.py From Deep-learning-model-deploy-with-django with GNU General Public License v3.0 | 5 votes |
def testupload(self): """ Ensure request.POST returns no content for POST request with file content. """ factory = APIRequestFactory() upload = SimpleUploadedFile("file.txt", b"file_content") request = Request(factory.post('App/upload', {'upload': upload})) request.parsers = (FormParser(), MultiPartParser()) assert list(request.POST) == [] assert list(request.FILES) == ['upload']