Here is what I have inside viewsets.py


from rest_framework.parsers import MultiPartParser, FormParser,
FileUploadParser

class CustomMultiPartParser(MultiPartParser):
    media_type = 'multipart/*'

class PictureViewSet(viewsets.ModelViewSet):
    queryset = Picture.objects.all().order_by('-created')
    serializer_class = PictureSerializer
    permission_classes = [PicturePermission]
    parser_classes = (CustomMultiPartParser, FormParser, FileUploadParser)

    def create(self, request):
        response = super(PictureViewSet, self).create(request)
        return response

On Tue, Aug 23, 2016 at 9:45 PM, <ggil...@gmail.com> wrote:
>
> I'm ready to tear my hair out. I've been searching and searching for a
working example of uploading to django using rest apis.
>
> I've looked at a lot of examples I've found searching, but none of them
seem to work.
>
> Do multipart forms work in the current version? I never get any of the
parameters across. JSON seems to work fine, but file uploading doesn't work
with JSON.
>
> Any help would be greatly appreciated.
>
>       Greg
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to django-rest-framework+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to