1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| 1.前端菜单跳转url,模板语言实现 base.html {% url 'server:idc_url' %}
2. 去server应用里的url.py 中创建路由 url(r'^idc/$', views.IdcListView.as_view(), name="idc_url"),
3. 在对应的视图中创建基于类的视图
server view.py
class Idclistview(View): def get(self,request): idc_info = {"idc": "这是IDC View"} return render(request, "idc.html",{"idc_data": idc_info})
4. idc.html idc.html
{% extends "base.html" %} {% block page_content %} <h1>{{ idc }}</h1> {% endblock %}
|