1👍
✅
@list_route(methods=['POST'], permission_classes=[AllowAny])
def test(self, request):
print(request.data)
print([(x, y) for x, y in request.data.items()])
print(request.data['owner'])
import ast
for x in ast.literal_eval(request.data['owner']):
print(x)
return Response("...")
<QueryDict: {'address': ['foo'], 'owner': ['[1,2]']}>
[('address', 'foo'), ('owner', '[1,2]')]
[1,2]
1
2
Ajax try:
data = {
address: 'foo'
owner: '[1,2]'
}
👤Ykh
0👍
I have the same problem, i solved this problem providing
serializer = TestSerializer(data=request.data.dict())
instead o f
serializer = TestSerializer(data=request.data)
I supose this inconvenient will be solved in a future release.
- Django Template getting apparent catchall error: "AssertionError at / No exception message supplied"
- Relative Template Import
- String to dict conversion
- Proxy my Elastic Search connection through Django for filtering
- Calling super method in Django TestCase causes RecursionError
Source:stackexchange.com