Django - Where are the params stored on a PUT/DELETE request?

前端 未结 7 1201
[愿得一人]
[愿得一人] 2020-11-30 00:17

I\'d like to follow the RESTful pattern for my new django project, and I\'d like to know where the parameters are when a PUT/DELETE request is made.

As far as I know

7条回答
  •  广开言路
    2020-11-30 01:07

    I am using django v1.5. And I mainly use QueryDict to solve the problem:

    from django.http import QueryDict
    put = QueryDict(request.body)
    description = put.get('description')
    

    and in *.coffee

    $.ajax
          url: "/policy/#{policyId}/description/"
          type: "PUT"
          data:
            description: value
          success: (data) ->
            alert data.body
          fail: (data) ->
            alert "fail"
    

    You can go here to find more information. And I hope this can help you. Good luck:)

提交回复
热议问题