Python Django functions

I tried everything, why my 'POST request' from 'send' function isn't considered in the 'checkview' function ?

def send(request):
    room = request.POST['room_name']
    import yfinance as yf
    aapl = yf.Ticker(room)
    ainfo = aapl.history(period='1y')
    #Plot the Chart
    import plotly.graph_objects as go
    fig = go.Figure(data=go.Scatter(x=ainfo.index,y=ainfo.Close, mode='lines'))
    #x =

    #DB inject plot
    rx = str(randint(9999,99999))

    #DB Inject from send
    plot_id = str(room+rx) 
    new_message = Message.objects.create(room=plot_id)
    return HttpResponse('All Good in send')

def checkview(self):
    chart_id = Message.objects.get(room=plot_id)
    return JsonResponse(, safe=False)

Here is the error:

django.utils.datastructures.MultiValueDictKeyError: 'room_name'

I ultimately need to transfer through AJAX the plot_id variable.

Back to Top