0👍
You can make HTTP POST request instead of GET to pass JSON data to a backend. For example:
$.ajax({
method: "POST",
url: endpoint,
data: {
"organisation": "organisation_name"
},
success: function(data){
//...... some logic there
}
})
This would pass data
as JSON serialized object to Django view.
And then on the Django view you can deserialize the organisation and filter the model:
import json
def get(self, request, format=None):
json_data = json.loads(request.body)
organisation_name = json_data.get("organisation")
organizations = Opp.objects.filter(name=organisation_name).values()
data = list(organizations)
return Response(data)
- Chartjs-Issues with Moment and ChartJS Time Format Parsing
- Chartjs-Chart.js doesn't show chart while on flask blueprint
Source:stackexchange.com