Django 1.10 + Django Restless 0.0.10 and Request empty

0

I'm using django restless views to build some REST interfaces and in all posts the request.POST and request.params are blank.

If I run:

print request
print request.POST

I have the following return:

<WSGIRequest: POST '/ambiente/alo/cadastrosplash/448/'>
<QueryDict: {}>

The following is the header of the methods that inherit from restless.views.Endpoint:

from restless.views import Endpoint
class CadastroSplash(Endpoint):
    def post(self, request, idCampanha, **kwargs):

In url.py, the setting looks like this:

from django.views.decorators.csrf import ensure_csrf_cookie
from meuprojeto.meupacote.views import CadastroSplash

urlpatterns = [
    url(r'^cadastrosplash/(?P<idCampanha>\d{1,8})/$$',
         ensure_csrf_cookie(CadastroSplash.as_view())),
]

In this way the "post" method is executed correctly, the value of the idCampanha parameter is filled, however with empty request fields.

If I create a view method the request comes correctly filled, but it's something I would not want to do for the sake of standardizing methods.

Some additional info: I'm using django with apache2 and WSGI module. The form is a multipart / form-data for uploading files. There is this same application running with django 1.5 and djangorestless 0.0.9 on the same server in a separate virtualenv, this method works correctly and receives all parameters.

Thank you all for the attention

    
asked by anonymous 08.12.2016 / 22:18

1 answer

0

I contacted the djangorestless developer on github.

The method dispatch of class restless.views.Endpoint has in the first line:

request.content_type = request.META.get('CONTENT_TYPE', 'text/plain')

This code when executed causes a multipart / form-data form to be cleaned in django 1.10.

Developer has already reported that it will fix the problem.

    
09.12.2016 / 16:42