温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

配置文件更新展示

发布时间:2020-07-01 15:59:27 来源:网络 阅读:463 作者:krven1983 栏目:开发技术

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 %}


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI