2012-08-31 2 views
0

이 문제가 장고 또는 HTML인지 여부는 확실하지 않으므로 둘 다 포함합니다. 이것은 내가 마우스 오른쪽 버튼을 클릭하고 "소스보기"를 선택했을 때 표시되는 HTML입니다 :이상한 html 렌더링 이상.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <link href="/static//CSS/postingformstyle.css" rel="stylesheet" type="text/css" /> 
</head> 

<body> 
<div style="width:100%;"> 

    <span class="posting_title">Original Work</span> 

    <form action="" method="post" class="base_form"> 
     <p><label for="id_title">Title:</label> <input type="text" name="title" id="id_title" /></p> 
     <input type="hidden" name="id">8</input> 
     <input type="submit" class="posting_button">Post</input> 
    </form> 
</div> 
</body> 
</html> 

이것은 내가 무엇을 얻을, 그리고 무엇을 내가 구글 크롬에서 요소를 검사 클릭하면, 렌더링 보인다. 모든 끝 태그가 양식에 없음을 알았습니다. (문제가있는 경우)

.posting_button { 
    display:block; 
    font-size:20px; 
    width:100%; 
} 
.posting_title { 
    text-align:center; 
    display:block; 
    color:black; 
    font-size:30px; 
    font-family:Arial, Helvetica, sans-serif; 
    margin: 2px 0 15px 0; 
} 
.base_form label { 
    font-size: 17px; 
    font-family: arial; 
    font-weight: bold; 
    display: block; 
} 
.base_form > p { 
    margin: 2px 0 5px 0; 
} 

이 장고입니다 :

템플릿 :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <link href="{{ STATIC_URL }}/CSS/postingformstyle.css" rel="stylesheet" type="text/css" /> 
</head> 

<body> 
<div style="width:100%;"> 

    <span class="posting_title">Original Work</span> 

    <form action="" method="post" class="base_form"> 
     {{ form.as_p }} 
     <input type="hidden" name="id">{{ id }}</input> 
     <input type="submit" class="posting_button">Post</input> 
    </form> 
</div> 
</body> 
</html> 

Views.py

<html xmlns="http://www.w3.org/1999/xhtml"><head> 


    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> 
    <link type="text/css" rel="stylesheet" href="/static//CSS/postingformstyle.css"> 
</head><body> 
<div style="width: 100%;"> 

    <span class="posting_title">Original Work</span> 

    <form class="base_form" method="post" action=""> 
     <p><label for="id_title">Title:</label> <input type="text" id="id_title" name="title"></p> 
     <input type="hidden" name="id">8 
     <input type="submit" class="posting_button">Post 
    </form> 
</div> 
</body></html> 

는 CSS입니다
def posting_story_ow(request): 
    if request.method == 'POST': 
     d = 12 
    return render_to_response('Posting/Forms/posting_post_ow.html', {'STATIC_URL':STATIC_URL, 'id' : request.GET['id'], 'alertnum': 0, 'form': post_ow}) 

답변

5

문제는 HTML입니다. 입력 태그는 열기 및 닫기를 갖지 않아야합니다. 당신이 대신해야

<input type="hidden" name="id">{{ id }}</input> 

:

<input type="hidden" name="id" value="{{ id }}"> 

편집 :

당신이 무엇을 달성하고 싶은지 달성하기 위해 당신이 관심이 있다면 사양 : http://www.w3.org/TR/html401/interact/forms.html#h-17.4