码迷,mamicode.com
首页 > 其他好文 > 详细

配置文件更新展示

时间:2017-03-28 14:39:32      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:配置文件   更新展示   

python文件

def nginx_update(request):
    all_server = NginxEThistory.objects.all()
    paginator = Paginator(all_server,20)

    try:
        page = int(request.GET.get(‘page‘,‘1‘))
    except ValueError:
        page = 1

    try:
        all_server = paginator.page(page)
    except :
        all_server = paginator.page(paginator.num_pages)
    return render_to_response(‘nginx_history.html‘,
                      {‘all_host_list‘: all_server, ‘page‘: page, ‘paginator‘:paginator},context_instance=RequestContext(request))

html文件

{% extends "index.html" %}
{% block title %}OMS{% endblock %}
{% block css %}
<!-- DataTables-->
<link rel="stylesheet" href="/static/plugins/dataTables/css/dataTables.css">
{% endblock %}
{% block content %}
      <div class="row">
            <div class="col-md-12">
                 <div class="panel panel-default">
                      <div class="panel-body">
                           {% if all_host_list %}
                           <table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
                               <thead>
                                   <tr>
                                      <th>ID</th>
                                      <th>文件名</th>
                                      <th>回显</th>
                                   </tr>
                               </thead>
                               <tbody>
                               {% for all_host in all_host_list %}
                                   <tr>
                                      <td>{{ forloop.counter }}</td>
                                      <td>{{ all_host.filename }}</td>
                                      <td>{{ all_host.message }}</td>
                                      <td><a href="http://:8999/nginxbjh/?id={{ all_host.id }}" class="btn btn-info btn-sm">编辑</a>
                                           <a href="{% url ‘huixianhistory‘ id=all_host.id %}" class="btn btn-info btn-sm">回显展示</a></td>
                                   </tr>
                               {% endfor %}
                               </tbody>
                            </table>
                           {% endif %}
                            <div class="row">
                                 <div class="col-xs-6">
                                       <div class="dataTables_info" id="example_info" role="alert" aria-live="polite" aria-relevant="all"></div>
                                 </div>
                                 <div class="col-xs-6">
                                      <div class="dataTables_paginate paging_simple_numbers" id="exmaple_paginate">
                                           <a href="{% url ‘xianip‘ %}" class="btn btn-info btn-sm" role="button">添加</a>
                                           {% if all_host_list.has_previous %}
                                                <a href="?page={{ all_host_list.previous_page_number }}">上一页</a>
                                           {% endif %}
                                           <span class="current">
                                                第{{ all_host_list.number }}页,共{{ all_host_list.paginator.num_pages }}页
                                           </span>
                                           {% if all_host_list.has_next %}
                                                <a href="?page={{ all_host_list.next_page_number }}">下一页</a>
                                           {% endif %}
                                      </div>
                                 </div>
                           </div> <!--row end-->
                         </div>
                     </div>
                 </div>
{% endblock %}


本文出自 “学习linux” 博客,请务必保留此出处http://10265013.blog.51cto.com/10255013/1910978

配置文件更新展示

标签:配置文件   更新展示   

原文地址:http://10265013.blog.51cto.com/10255013/1910978

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!