I have an Angular/DRF application.
What I want is to send an object to my backend to process it:
var data = {'url': url, 'name': name}
return this.http.get("http://127.0.0.1:8000/api/record/json=" + encodeURIComponent(JSON.stringify(data)))
Because my data as URL in it, I URI encode it to escape the "/"
Then in DRF this my urls.py:
path('record/<str:music_details>', record_views.Record.as_view(), name='record'),
And my views.py:
class Record(View):
def get(self, request):
json_string = request.query_params['json']
data = json.loads(json_string)
print(data)
I have nothing printing in my console, I assume my url path is wrong, how should I fix it?
/api
preceding the record part of the url. Unless you're explicitly adding this somewhere in django, I don't think you need it/api
are redirected to this urls.py