Python 相关下拉错误';元组';对象没有属性';获取';

Python 相关下拉错误';元组';对象没有属性';获取';,python,django,Python,Django,我正在写一个相关下拉列表。第一个下拉值是根据第二个下拉列表选择的。有一个错误是“tuple”对象没有属性“get” 请求方法:获取 请求URL: Django版本:3.0.7 异常类型:AttributeError 异常值: “tuple”对象没有属性“get” 异常位置:/usr/local/lib/python3.8/dist-packages/django/middleware/clickjacking.py,在process_响应中,第26行 Python可执行文件:/usr/bin/p

我正在写一个相关下拉列表。第一个下拉值是根据第二个下拉列表选择的。有一个错误是“tuple”对象没有属性“get” 请求方法:获取 请求URL: Django版本:3.0.7 异常类型:AttributeError 异常值:

“tuple”对象没有属性“get”

异常位置:/usr/local/lib/python3.8/dist-packages/django/middleware/clickjacking.py,在process_响应中,第26行 Python可执行文件:/usr/bin/python3 Python版本:3.8.3 Python路径:

['/root/Documents/optionplus', “/usr/lib/python38.zip”, “/usr/lib/python3.8”, “/usr/lib/python3.8/lib dynload”, “/usr/local/lib/python3.8/dist包”, “/usr/lib/python3/dist包”, “/usr/lib/python3.8/dist包”]


服务器时间:2020年8月29日星期六20:57:06+0530

在网页中,您似乎正在使用POST。尝试在代码中使用
name1=request.POST.get('company')
。它仍然会给出相同的错误。虽然错误已经解决,但我使用了JsonResponse
   **PCR.html**


<div class="main-container">
            <p>PCR LIVE INDICATOR</p>
            <form method="POST" id="pcrchart" data-pcr-url="{% url 'ajax_expiry'%}">
                <div class="drop1">
                    <label>Select Symbol</label>

                    <select name="company" id="company" size="1">
                        <option value="" selected="selected">Nifty</option>
                        {%  for i in d %}
                        <option value="{{i.name}}">{{i.name}}</option>
                        {% endfor %}
                    </select>
                </div>


                <div class="drop2">
                    <label>Select Expiry</label>
                    <select name="expiryDate" id="expiryDate" size="1">
                        
                    </select>

                </div>
                <div class="drop3">
                    <label>Select Strike</label>
                    <br>
                    <select name="price" id="price" size="1">
                        <option value="" selected="selected">12700</option>
                        {% for Price in Prices %}
                        <option value="{{price.pk}}">{{price.name}}</option>
                        {% endfor %}

                    </select>
                </div>

            </form>
<option value="" selected="selected">27 Aug 2020</option>
{% for expiryDate in expiry %}
<option value="{{expiryDate.expiry}}" title="27 Aug 2020">{{expiryDate.expiry}}</option>
{% endfor %}
def pcr(request):
    d={}
    d = stock.objects.all()
    return render(request,'pcr.html',{"d":d})

def expiry(request):
    name1 = request.GET.get('company')
    print(name1)
    expiry=NFO.objects.all().filter(name=name1)   
    return (request,'pcr1.html',{
        'expiry': expiry,
    })