Django引导模式窗口
我有这样的问题:我没有在django引导(22.3.2)模式窗口中加载数据,我想加载给定索引的文本。我不知道我的错误在哪里。这是我的密码 MAIN.HTMLDjango引导模式窗口,django,twitter-bootstrap,modal-dialog,Django,Twitter Bootstrap,Modal Dialog,我有这样的问题:我没有在django引导(22.3.2)模式窗口中加载数据,我想加载给定索引的文本。我不知道我的错误在哪里。这是我的密码 MAIN.HTML <a data-toggle="modal" href="show_modal_topic.html/{{topic_id}}/" data-target="#myModal">click me</a> {% include "show_modal_topic.html" %} VIEWS.PY def load_
<a data-toggle="modal" href="show_modal_topic.html/{{topic_id}}/" data-target="#myModal">click me</a>
{% include "show_modal_topic.html" %}
VIEWS.PY
def load_topic(request, topic_id):
topic = tab_topics.objects.get(id_topic=topic_id)
text_topic = topic.text
return render_to_response("show_modal_topic.html", {
'text_topic': text_topic,
},
context_instance=RequestContext(request))
SHOW_MODAL_TOPIC.HTML
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Opinione</h4>
</div>
<div class="modal-body">
{{text_topic}}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
&时代;
意见
{{text_topic}}
接近
你能帮我吗?我不明白我错在哪里。谢谢我想你需要更新你的url.py来定义传递给视图的变量名
url(r'^show_modal_topic.html/(?P<topic_id>\d+)/$', views_topics.load_topic),
url(r'^show\u modal\u topic.html/(?P\d+)/$,views\u topics.load\u topic),
谢谢Rohan,我会尝试一下,我很感谢你花时间帮我解决问题。我有一个问题:模式窗口在“所有”页面中很旧,不像模式窗口。问题出在哪里?@RoverDar,不确定可能是页面内容返回还是ajax处理。
url(r'^show_modal_topic.html/(?P<topic_id>\d+)/$', views_topics.load_topic),