2016-08-05 92 views
-2

我有一個保存按鈕的HTML頁面,但我不能保存數據,同時點擊保存按鈕。我無法使用保存按鈕保存數據django

如何在Python運行這段代碼的Django

HTML

<form action="demo_form.asp" method="get"> <button type="submit" value="Submit">Submit</button> </form>

+0

請幫助我.. – Apu

+2

請提供任何錯誤消息,當前行爲和期望的行爲。看[如何問](http://stackoverflow.com/help/how-to-ask)。 – Will

+0

提供代碼部分,配置信息和錯誤stacktraces將幫助所有人瞭解發生了什麼或發生了什麼。 –

回答

0

urls.py
url(r'^Ist_std/$', views.Ist_std, name='Ist_std'),

HTML

{% load staticfiles %} 

    <!DOCTYPE html> 
    <html> 
    <head> 
    <title>Attendance register</title> 
    <style> 
    table, th, td { 
     border: 1px solid black; 
     border-collapse: collapse; 
    } 
    th, td { 
     padding: 5px; 
     text-align: left; 
    } 
    table#t01 { 
     width: 100%;  
     background-color: #f1f1c1; 
    } 
    </style> 
    </head> 
    <body> 
    <h1><center><u>ATTENDANCE-REGISTER</u></center></h1><br> 
    <h2><center><i>Ist Standard</i></center></h2> 
    <h4>Class in-charge: Hema.B <br><br> 
    Date: June 2016 - March 2017</h4> 


    <form name="demo_form.asp" method="get"> 
    <button type="submit" value="continue">Submit</button> 
    </form> 

    {% if user.is_authenticated %} 
    <a href="{% url 'post_new' %}" class="top-menu"><span class="glyphicon glyphicon-plus"></span></a> 
    {% endif %} 

    <table style="width:100%"> 
     <tr> 
    <th>Slno</th> 
     <th>Name</th> 
     <th>Attendance</th> 
     </tr> 
     <tr> 
    <td>1</td> 
     <td>Abijith</td> 
     <td><input type="number" id="aNumber"> 
    <button onclick="aFunction()"><font color="green">Present</button> 
    <button onclick="abFunction()"><font color="red">Absent</button> 
    <input type="number" id="abNumber"> 
    </td> 
     </tr> 
     <tr> 
    <td>2</td> 
     <td>Adithya</td> 
     <td><input type="number" id="bNumber"> 
    <button onclick="bFunction()"><font color="green">Present</button> 
    <button onclick="acFunction()"><font color="red">Absent</button> 
    <input type="number" id="acNumber"></td> 

     </tr> 
     <tr> 
    <td>3</td> 
     <td>Bavana</td> 
     <td><input type="number" id="cNumber"> 
    <button onclick="cFunction()"><font color="green">Present</button> 
    <button onclick="adFunction()"><font color="red">Absent</button> 
    <input type="number" id="adNumber"></td> 

     </tr> 
    <tr> 
    <td>4</td> 
     <td>Bibin</td> 
     <td><input type="number" id="dNumber"> 
    <button onclick="dFunction()"><font color="green">Present</button> 
    <button onclick="aeFunction()"><font color="red">Absent</button> 
    <input type="number" id="aeNumber"></td> 

     </tr> 
    <tr> 
    <td>5</td> 
     <td>Devan</td> 
     <td><input type="number" id="eNumber"> 
    <button onclick="eFunction()"><font color="green">Present</button> 
    <button onclick="afFunction()"><font color="red">Absent</button> 
    <input type="number" id="afNumber"></td> 

     </tr> 
    <tr> 
    <td>6</td> 
     <td>Faizal</td> 
     <td><input type="number" id="fNumber"> 
    <button onclick="fFunction()"><font color="green">Present</button> 
    <button onclick="agFunction()"><font color="red">Absent</button> 
    <input type="number" id="agNumber"></td> 

     </tr> 
    <tr> 
    <td>7</td> 
     <td>Ganga</td> 
     <td><input type="number" id="gNumber"> 
    <button onclick="gFunction()"><font color="green">Present</button> 
    <button onclick="ahFunction()"><font color="red">Absent</button> 
    <input type="number" id="ahNumber"></td> 

     </tr> 
    <tr> 
    <td>8</td> 
     <td>Haris</td> 

    <td><input type="number" id="hNumber"> 
<button onclick="hFunction()"><font color="green">Present</button> 
<button onclick="aiFunction()"><font color="red">Absent</button> 
<input type="number" id="aiNumber"></td> 
    </tr> 
<tr> 
<td>9</td> 
    <td>Jamsina</td> 

    <td><input type="number" id="iNumber"> 
<button onclick="iFunction()"><font color="green">Present</button> 
<button onclick="ajFunction()"><font color="red">Absent</button> 
<input type="number" id="ajNumber"></td> 
    </tr> 
<tr> 
<td>10</td> 
    <td>Tara</td> 

    <td><input type="number" id="jNumber"> 
<button onclick="jFunction()"><font color="green">Present</button> 
<button onclick="akFunction()"><font color="red">Absent</button> 
<input type="number" id="akNumber"></td> 
    </tr> 


</table> 
<br> 

<body> 
<script> 



function aFunction() { 
    document.getElementById("aNumber").stepUp(); 


} 

function abFunction() { 
    document.getElementById("abNumber").stepUp(); 
} 
function bFunction() { 
    document.getElementById("bNumber").stepUp(); 
} 

function acFunction() { 
    document.getElementById("acNumber").stepUp(); 
} 
function cFunction() { 
    document.getElementById("cNumber").stepUp(); 
} 

function adFunction() { 
    document.getElementById("adNumber").stepUp(); 
} 
function dFunction() { 
    document.getElementById("dNumber").stepUp(); 
} 

function aeFunction() { 
    document.getElementById("aeNumber").stepUp(); 
} 
function eFunction() { 
    document.getElementById("eNumber").stepUp(); 
} 

function afFunction() { 
    document.getElementById("afNumber").stepUp(); 
} 
function fFunction() { 
    document.getElementById("fNumber").stepUp(); 
} 

function agFunction() { 
    document.getElementById("agNumber").stepUp(); 
} 
function gFunction() { 
    document.getElementById("gNumber").stepUp(); 
} 

function ahFunction() { 
    document.getElementById("ahNumber").stepUp(); 
} 
function hFunction() { 
    document.getElementById("hNumber").stepUp(); 
} 

function aiFunction() { 
    document.getElementById("aiNumber").stepUp(); 
} 
function iFunction() { 
    document.getElementById("iNumber").stepUp(); 
} 

function ajFunction() { 
    document.getElementById("ajNumber").stepUp(); 
} 
function jFunction() { 
    document.getElementById("jNumber").stepUp(); 
} 

function akFunction() { 
    document.getElementById("akNumber").stepUp(); 
} 
</script> 
</body> 
</html> 
0

action="demo_form.asp" 

部分告訴瀏覽器發佈的數據。由於它是指向一個ASP應用程序可能這就是問題

嘗試(除非你已經設置你的urls.py這樣?!):

action='' 

但同樣,你的urls.py文件需要一套我們不知道那裏有什麼。