For 루프가 아니라 내 Modelform 필드를 별도로 구문 분석하려고합니다. 그리고 일부 필드에서 장고 HTML을 구문 분석하여 해당 요소를 찾습니다. 나는이있다 : 내가 장고 HTML 양식 요소를 구문 분석하는 템플릿 코드에 ???
에서 원하는,Django, for 루프없이 단일 양식 필드 (HTML) 구문 분석 방법
<form action="#" method="POST" name="notifictaionForm">
<ul>
<li><label>{{ form.fields.title.label }}</label> <span>{{ notification.title }}</span></li>
<li><label>{{ form.fields.create_date.label }}</label> <span>{{ notification.create_date }}</span></li>
<li><label>{{ form.fields.description.label }}</label> <span>{{ notification.description }}</span></li>
<li><label>{{ form.fields.status.label }}</label> <span>{{ form.fields.status.??? }}</span></li>
</ul>
</form>
그래서 내가 필드 이름이 아니라 HTML 요소를 구문 분석 할 수 있습니다.
누군가이 작업을 수행하는 방법을 알고 있습니까?
고마워요! 나는 장고 문서의 각 루프에 대한 예제 때문에 form.fields 객체를 사용해야한다고 thougth. –
몇 가지 추가 단어를 추가, 나는 그것이 유용 할 것이라는 점을 희망한다 :) – Ski
+1 정말 좋은 답변! – jathanism