我重试并关注了https://pypi.org/project/django-bootstrap-modal-forms/
JS
$(function ()
{
// Create book button
$(".create-node").modalForm({ formURL: "{% url 'create_node' %}" });
});
我的网址
path('create/', mainapp.NodeCreateView.as_view(), name='create_node'),
我的观点
class NodeCreateView(BSModalCreateView):
template_name = 'includes/partial_node_create.html'
form_class = NodeForm
success_message = 'Success: Book was created.'
success_url = reverse_lazy('index')
我用来调用JS的按钮
<button class="create-node btn btn-primary" type="button" name="button">Create book</button>
仍然没有模态出现,还有什么可能出问题?