150👍
✅
You’re confusing form-encoded and JSON data here. request.POST['foo']
is for form-encoded data. You are posting raw JSON, so you should use request.body
.
received_json_data=json.loads(request.body)
86👍
For python3 you have to decode body first:
received_json_data = json.loads(request.body.decode("utf-8"))
- [Django]-Include intermediary (through model) in responses in Django Rest Framework
- [Django]-'RelatedManager' object is not iterable Django
- [Django]-Creating Custom Filters for list_filter in Django Admin
-4👍
Create a form with data as field of type CharField
or TextField
and validate the passed data. Similar SO Question
- [Django]-Is it better to use path() or url() in urls.py for django 2.0?
- [Django]-Django admin: how to sort by one of the custom list_display fields that has no database field
- [Django]-Django: Safely Remove Old Migrations?
Source:stackexchange.com