내 프로젝트에서 끌어서 놓기 기능을 만들려고 할 때 자동으로 항목을 삭제할 때 백엔드쪽에 자동으로 저장됩니다. 내 HTML 코드어떻게 장고 백엔드에서 끌어서 놓기를 저장합니까?
<script style="text/javascript">
$(function() {
$("#roles li").draggable({
appendTo: "body",
helper: "clone",
});
$("#item-roles li").droppable({
activeClass: "ui-state-default",
hoverClass: "ui-state-hover",
accept: ":not(.ui-sortable-helper)",
drop: function(event, ui) {
alert('you drop this')
$("<li></li>").text(ui.draggable.text()).appendTo(this);
}
})
});
가 여기에 표시됩니다.
<div id="item-roles">
<h3>Role in {{item.name|title}} Item</h3>
<ul>
<h3>Drag role here!</h3>
{% for item_role in item_roles %}
<li class="placeholder" style="list-style-type: none;">
{{item_role.show_role}} <a href="#">Remove</a>
</li>
{% empty%}
<li>No items found</li>
{% endfor %}
</ul>
</div>
<div id="roles">
<h3>Roles in this Show</h3>
<ul>
{% for role in roles %}
<li>
<a class="role-detail">{{ role.role_name }}</a>
</li>
{% empty %}
<p>No show roles </p>
{% endfor %}
</ul>
질문에 대한 언급은 잊지 마십시오. –