十三、首页模块
1.修改视图函数(./homeApp/views.py)
from django.shortcuts import render
from django.shortcuts import HttpResponse
Create your views here.
def home(request):
return render(request,‘home.html’)
2.在homeApp中新增模板文件夹,新增home.html文件
3.配置首页模板(home.html)
{% extends “base.html” %}
{% load static%}
{% block title %}
首页
{% endblock %}
{% block content %}
15
15
15
<div class="row row-3 col-md-12">
<div class="col-md-8">
<!-- 实验室 -->
<span class="part1">
<a href="{% url 'aboutApp:labinfo' %}">实验室概况</a>
</span>
<span class="part1 en"> / About Us
</span>
<div class="line1">
<div class="line2 theme"></div>
</div>
<div style="margin-top:20px;">
<img class="img-responsive" src="{% static 'images/sys.png' %}">
<p class="text1">
南开大学滨海学院于2004年经教育部批准设立,学院建院以来十分重视实验室建设,从建院至今,已投入九千多万元建设实验室。
在建设中,根据教学科研和学科建设需要,坚持“统筹规划、分步实施、资源共享、急用先建”的原则,使得学院各个实验室都能充分发挥效益。
</p>
</div>
</div>
<div class="col-md-4">
<!-- 通知公告 -->
<span class="part1">
<a href="#"><img src="{% static 'images/notice.jpeg' %}"style="width:30px;height:30px">通知公告</a>
</span>
<span class="part1 en">
/ Notice
</span>
<a class="btn btn-default btn-xs more-btn" href="{% url 'newsApp:news' '03' %}">
+ 更多
</a>
<div class="line1">
<div class="line2 theme"></div>
</div>
<div>
<ul class="list-unstyled list-new">
{% for note in noteList %}
<li>
<a href="{% url 'newsApp:newDetail' note.id %}">
{{note.XWBT|truncatechars:"25"}}
</a>
<span>【{{note.CJSJ|date:"Y-m-d"}}】</span>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
<div class="row row-3 col-md-12">
<div class="col-md-6">
<!-- 规章制度 -->
<span class="part1">
<a href="#"><img src="{% static 'images/gzzd.jpeg' %}"style="width:30px;height:30px">规章制度</a>
</span>
<span class="part1 en">
/ Regulations
</span>
<a class="btn btn-default btn-xs more-btn" href="{% url 'rulesApp:rules' '01' %}">
+ 更多
</a>
<div class="line1">
<div class="line2 theme"></div>
</div>
<div>
<ul class="list-unstyled list-new">
{% for gzzd in gzzdList %}
<li>
<a href="{% url 'rulesApp:ruleDetail' gzzd.id %}">
{{gzzd.GZZDBT|truncatechars:"25"}}
</a>
<span>【{{gzzd.CJSJ|date:"Y-m-d"}}】</span>
</li>
{% endfor %}
</ul>
</div>
</div>
<div class="col-md-6">
<!-- 新闻动态 -->
<span class="part1">
<a href="#"><img src="{% static 'images/news.jpeg' %}" style="width:30px;height:30px">新闻动态</a>
</span>
<span class="part1 en">
/ News
</span>
<a class="btn btn-default btn-xs more-btn" href="{% url 'newsApp:news' '02' %}">
+ 更多
</a>
<div class="line1">
<div class="line2 theme"></div>
</div>
<div class="col-md-10">
<ul class="list-unstyled list-new">
{% for mynew in newList %}
<li>
<a href="{% url 'newsApp:newDetail' mynew.id %}">
{{mynew.XWBT|truncatechars:"15"}}</a>
<span>【{{mynew.CJSJ|date:"Y-m-d"}}】</span>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
<div class="row row-3 col-md-12">
<div class="col-md-6">
<!-- 规章制度 -->
<span class="part1">
<a href="#"><img src="{% static 'images/gzzd.jpeg' %}"style="width:30px;height:30px">安全管理制度</a>
</span>
<span class="part1 en">
/ Regulations
</span>
<a class="btn btn-default btn-xs more-btn" href="{% url 'rulesApp:rules' '01' %}">
+ 更多
</a>
<div class="line1">
<div class="line2 theme"></div>
</div>
<div>
<ul class="list-unstyled list-new">
{% for aqzd in aqglzdList %}
<li>
<a href="{% url 'rulesApp:ruleDetail' aqzd.id %}">
{{aqzd.GZZDBT|truncatechars:"25"}}
</a>
<span>【{{aqzd.CJSJ|date:"Y-m-d"}}】</span>
</li>
{% endfor %}
</ul>
</div>
</div>
<div class="col-md-6">
<!-- 实验室信息 -->
<span class="part1">
<a href="#"><img src="{% static 'images/lab.png' %}" style="width:30px;height:30px">实验室信息</a>
</span>
<span class="part1 en">
/ Labs
</span>
<a class="btn btn-default btn-xs more-btn" href="{% url 'aboutApp:labs' '01' %}">
+ 更多
</a>
<div class="line1">
<div class="line2 theme"></div>
</div>
<div>
<ul class="list-unstyled list-new">
{% for labxx in labtList %}
<li>
<a href="{% url 'aboutApp:labDetail' labxx.id %}">
{{labxx.LABMC|truncatechars:"25"}}
</a>
<span>【{{labxx.CJSJ|date:"Y-m-d"}}】</span>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
<div class="row row-3">
<!-- 友情链接 -->
<div class="col-md-12">
<span class="part1">
<a href="#">友情链接</a>
</span>
</div>
<div class="line1">
<div class="line2 theme"></div>
</div>
<div class="col-md-2">
<a href="http://binhai.nankai.edu.cn/">南开大学滨海学院</a>
</div>
<div class="col-md-2">
<a href="http://binhai.nankai.edu.cn/">滨海学院教务网</a>
</div>
<div class="col-md-2">
<a href="http://binhai.nankai.edu.cn/">滨海学院实验室</a>
</div>
<div class="col-md-2">
<a href="http://binhai.nankai.edu.cn/">滨海学院图书馆</a>
</div>
<div class="col-md-2">
<a href="http://binhai.nankai.edu.cn/">就业指导中心</a>
</div>
<div class="col-md-2">
<a href="http://binhai.nankai.edu.cn/">滨海学院新闻网</a>
</div>
</div>
{% endblock %}