我有GET和POST方法行事不同的景色,我有包含2個鏈接到相應的URL製作一個鏈接通過POST方法在Django
<!DOCTYPE html>
<html>
<head>
<script language="JavaScript" type="text/javascript">
function getsupport (selectedtype)
{
document.create_station.supporttype.value = selectedtype ;
document.create_station.submit() ;
}
</script>
</head>
<body>
<h1> Hey {{ object.username }}! </h1>
<p><a href="{% url 'list_create_station' %}">View your stations</a> </p>
<form name="create_station" method="post" action="">
<input type="hidden" name="supporttype" />
<a href="{% url 'list_create_station' %}">Create a new Station</a>
</form>
</body>
</html>
我想一個頁面下面的模板使第二個鏈接通過一個POST方法,而不是GET在代碼幫助http://www.thesitewizard.com/archive/textsubmit.shtml
但鏈接仍然通過GET,使用Chromium開發人員工具對其進行驗證。
我是一個新手,因此從字面上複製了引用中的代碼。我瞭解零件和零件,所以請有人給出相應的答案。如果有人告訴我我在做什麼錯誤,並向我解釋我必須做出什麼改變,那將是可愛的。
請記住,您可以使按鈕看起來像使用CSS的超鏈接。 –
隱藏的輸入也是不必要的,JavaScript也是如此。我想我們可以通過某種方式實際發佈「鏈接」。但是這對我來說已經足夠了。 –
@Filly請查看http://stackoverflow.com/questions/30243865/django-get-got-an-unexpected-keyword-argument-pk-error –