안녕하세요 저는 항목 목록을 표시하는 템플릿 양식이 있습니다. 이 템플릿을 edit_order.html이라고합니다. 다른 항목 목록에서 새 항목을 추가 할 수 있기를 원합니다. 다른 항목 목록에서 items.html이라는 템플리트가 항목 목록을 표시합니다. items.html에서 각 항목에는 항목 외에도 확인란이 있습니다. 이제는 항목이 edit_order 템플릿에 이미 나열되어있는 경우에만 체크 박스를 표시하도록하고 싶습니다. 현재 모든 항목이 표시됩니다. 하지만 나는 이것을 원하지 않는다.Django checkbox 질문
{% extends "base_menu.html" %}
{%block script%}
<script type="text/javascript">
$(function(){
$("#check_all").click(function(){
if(this.checked ==true)
$("tbody :checkbox").each(function(){
this.checked=true;
});
else
$("tbody :checkbox").each(function(){
this.checked=false;
});
});
});
</script>
{%endblock%}
<td><a href="{% url tiptop.views.edit_item item.client.pk item.pk %}" onclick="return showAddAnotherPopup(this);">Edit</a></td>
</tr>
{% endfor %}
</tbody>
</table></fieldset>
</div>
<div id="form_footer">
<input type="submit" value="Request Delivery" onclick="change_action('{% url tiptop.views.service_order client.pk 1 %}')">
<input type="submit" value="Request Pick Up" onclick="change_action('{% url tiptop.views.service_order client.pk 2 %}');validate_status(this.form)">
</div>
</form>
{% endblock %}
{% block right_content %}
<div id="location_header">{{client}}: Search results</div>
<form action="{% url tiptop.views.service_order client.pk 1 %}" method="post" onsubmit="return validate_selection(this)">
<div class="form_container">
<fieldset class="model">
<table id="items_table">
<thead>
<tr>
<th><input type="checkbox" id="check_all" checked="checked"></th>
<th scope="col">Tiptop no.</th><th scope="col">Client no.</th><th scope="col">Title</th><th scope="col">Type</th>
<th scope="col">Format</th><th scope="col">Status</th><th scope="col">Date</th>
</tr>
</thead>
<tbody>
{% for item in items %}
<tr class="items_table_row">
<td><input type="checkbox" name="{{item.pk}}" value="{{item.pk}}" checked="checked"></td>
<td>{{item.tiptop_id}}</td><td>{{item.alternative_id}}</td><td>{{item.title}}</td><td>{{item.type}}</td><td>{{item.format}}</td>
<td><span id="{{item.pk}}" name="type">{{item.itemstatushistory_set.latest}}</span></td><td>{{item.itemstatushistory_set.latest.date.date|date:"d M Y"}}</td>
저는 장고 양식을 사용하고 있습니다. 나는 내 견해를 올리지 않았다. 이미 체크리스트가 있습니다. 항목을 나열하는 템플릿이 있습니다. 이 템플릿에서 항목을 추가하고 싶습니다. 이제는 항목을 추가하여 양식을 만드는 것이 아닙니다. 내 말은, 기존의 모든 클라이언트 항목을 나열하는 페이지 (이 템플릿이 있음)로 이동한다는 것입니다. 이 템플릿에는 추가 할 기존 항목을 선택할 수있는 목록이 있습니다. 문제가있는 것은 체크 박스입니다. 그들은 어떤 이유로 든 내 코드에서 모두 '틱 (ticked)'합니다. 템플릿 항목 목록의 항목에 체크 표시를하고 빈 칸으로 표시합니다. – Shehzad009