django get kann keinen Wert abrufen – Stapelüberlauf
怪我咯
怪我咯 2017-07-05 10:34:26
0
1
829

views.py

def Del_table(request,id):
    if request.method == 'GET':
        nid = request.GET.get('name.id')
        return render(request,'del.html',{'nid':nid})

del.html

{{nid}}

table.html

    <tr>
        <td style="word-wrap:break-word" width="5%" align="center" >{{ name.id }}</td>
        <td style="word-wrap:break-word" width="5%" align="center" >{{ name.name }}</td>
        <td style="word-wrap:break-word" width="5%" align="center" >{{ name.author }}</td>
        <td style="word-wrap:break-word" width="5%" align="center" >{{ name.serialstatus }}</td>
        <td style="word-wrap:break-word" width="5%" align="center" >{{ name.category }}</td>
        <td style="word-wrap:break-word" width="40%" align="center" >{{ name.introduction }}</td>
        <td style="word-wrap:break-word" width="40%" align="center" >
            <p><a href="/edit/{{name.id}}" >Edit</a></p>
            <p><a href="/del/{{name.id}}">Del</a> </p>
            <p> <a href="/add/{{name.id}}">Add</a> </p>
        </td>
        </tr>

urls.py

url(r'^del/(?P<id>\d+)/$',ve.Del_table,name='del')

Besuchen Sie http://127.0.0.1:8888/del/316/ und die Seite gibt keine zurück

怪我咯
怪我咯

走同样的路,发现不同的人生

Antworte allen(1)
曾经蜡笔没有小新

id以参数的方式传入了,不需要再通过request.GET.get的方式获取,直接用id这个变量

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage