再會,我問自己,是否可以在我的模板中傳輸多個信息作為主鍵???例如,當單擊我的表格內的鏈接時......在這種情況下,我會傳輸 item-id:<tbody> {% for item in dataset %} <tr> <td> <a href="{% url 'Examplepage' item.id %}">Item-Name</a> </td> </tr> {% endfor %}</tobdy>現在我想轉移 ID 和 - 比方說 - 名字!這樣的事情有可能嗎?<tbody> {% for item in dataset %} <tr> <td> <a href="{% url 'Examplepage' item.id item.name %}">Item-Name</a> </td> </tr> {% endfor %}</tobdy>如果可能的話,我是否必須更改 urls.py 中的某些內容?現在它看起來像這樣:path('index/<str:pk>', views.example, name="Example"),感謝您的所有幫助,祝您有美好的一天!
Django:將多個數據傳輸到下一個模板
幕布斯7119047
2023-10-18 15:52:40