单独记录展示和历史单独记录展示

Python代码

def huixian(request, id):
    if request.method == ‘GET‘:
        id1 = id
        all_server = NginxET.objects.filter(id=id1)
        all_server1 = NginxET.objects.values_list(‘message‘, flat=True).get(id=id1)
        paginator = Paginator(all_server,10)

        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(‘nginxmessage.html‘,
                     {‘all_host_list‘: all_server, ‘page‘: page, ‘paginator‘:paginator})

def huixianhistory(request, id):
    if request.method == ‘GET‘:
        id1 = id
        all_server = NginxEThistory.objects.filter(id=id1)
        all_server1 = NginxEThistory.objects.values_list(‘message‘, flat=True).get(id=id1)
        paginator = Paginator(all_server,10)

        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(‘nginxhistory.html‘,
                     {‘all_host_list‘: all_server, ‘page‘: page, ‘paginator‘:paginator})

models代码

class NginxEThistory(models.Model):
    dirname = models.CharField(max_length=50, verbose_name=u‘目标地址‘)
    filename = models.CharField(max_length=100, verbose_name=u‘文件名‘)
    message = models.TextField(verbose_name=u‘nginx内容‘)
    onlinetime = models.DateTimeField(max_length=100, blank=True, verbose_name=u‘上线时间‘)

    def __unicode__(self):
        return u‘%s - %s - %s - %s‘ %(self.dirname, self.filename, self.message, self.onlinetime)

    class Meta:
        verbose_name = u‘目标地址‘
        verbose_name = u‘文件名‘

http代码展示

nginxmessage文件
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <!-- Favicon -->
    <link rel="shortcut icon" href="/static/img/favicon.ico" type="image/x-icon">
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="/static/plugins/bootstrap/css/bootstrap.min.css">
    <!-- Fonts from Font Awsome -->
    <link rel="stylesheet" href="/static/css/font-awesome.min.css">
    <!-- CSS Animate -->
    <link rel="stylesheet" href="/static/css/animate.css">
    <!-- Custom styles for this theme -->
    <link rel="stylesheet" href="/static/css/main.css">
    
    <!-- Fonts -->
    <!-- <link href=‘http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,900,300italic,400italic,600italic,700italic,900italic‘ rel=‘stylesheet‘ type=‘text/css‘>
    <link href=‘http://fonts.googleapis.com/css?family=Open+Sans:400,700‘ rel=‘stylesheet‘ type=‘text/css‘> -->
    <!-- Feature detection -->
    <script src="/static/js/modernizr-2.6.2.min.js"></script>
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="/static/js/html5shiv.js"></script>
    <script src="/static/js/respond.min.js"></script>
    <![endif]-->
</head>
      <body>
      <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/nginxbj/?id={{ all_host.id }}" class="btn btn-info btn-sm">编辑</a>
                                           <a href="{% url ‘huixian‘ 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>

</body>

</html>

nginxhistory 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 %}
时间: 2024-11-08 19:09:39

单独记录展示和历史单独记录展示的相关文章

js操作Cookie,实现历史浏览记录

/** * history_teacher.jsp中的js,最近浏览名师 * @version: 1.0 * @author: mingming */ $(function(){ getHistory(); }); var historyCount=4; //保存历史记录个数 /** * 增加浏览历史记录 * @param id 编号 * @param name 姓名 * @param photo 照片 * @param grade 年级 * @param subject 科目 * @retur

Django之使用redis缓存session,历史浏览记录,首页数据实现性能优化

Redis缓存session 配置Django缓存数据到redis中 # diango的缓存配置 CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", # 用户的session信息,历史浏览记录存储在redis数据库9中 "LOCATION": "redis://127.0.0.1:6379/9", "OPTIONS

git查看历史提交记录

#git查看历史提交记录 `git log --pretty=oneline filename`

【玩转SQLite系列】(六)SQLite数据库应用案例实现历史搜索记录

转载请注明出处:http://blog.csdn.net/linglongxin24/article/details/53366564 本文出自[DylanAndroid的博客] [玩转SQLite系列]文章目录 [玩转SQLite系列](一)初识SQLite,重拾sql语句 [玩转SQLite系列](二)SQLite创建和打开数据库的三种方式 [玩转SQLite系列](三)通过sql语句操作SQLite数据库 [玩转SQLite系列](四)通过Android提供的API操作SQLite数据库

记录文件浏览历史路径

这里使用ComboBox显示和记录浏览历史,用*.ini文件永久记录浏览历史,这里记录的是文件夹路径,记录文件路径也是一样的. string inimultipleFilePath = Application.StartupPath + @"\Plugin\CreateWaterhistoricalpath.ini";//*.ini文件的存放路径 List<string> listHistory = new List<string>();//用于临时存储浏览历史

shell历史命令记录功能

在Linux下可通过history命令查看用户所有的历史操作记录,同时shell命令操作记录默认保存在用户目录下的.bash-history文件中,通过这个文件可以查询shell命令的执行历史,有助于运维人员进行系统审计和问题排查,同事,在服务器遭受黑客攻击后,也可以通过这个命令或文件查询黑客登录服务器所执行的历史命令操作,但是有时候黑客在入侵服务器后为了毁灭痕迹,可能会删除.bash_history文件,这就需要合理保护或备份.bash_history文件 让history命令自动记录所有sh

react 跳转但不记录当前页面历史路径

this.props.history.push({pathname:'/my/order/sureorder',state: {from: 'single'}});//跳转 this.props.history.replace({pathname:'/my/order/sureorder',state: {from: 'single'}}); //跳转但不记录当前页面历史路径

linux下history命令显示历史指令记录的使用方法

linux下history命令显示历史指令记录的使用方法 History命令主要用于显示历史指令记录内容, 下达历史纪录中的指令 .1>History命令语法: [[email protected]]# history [n][[email protected]]# history [-c][[email protected]]# history [-raw] histfiles参数:n   :数字,要列出最近的 n 笔命令列表-c  :将目前的shell中的所有 history 内容全部消除-

destoon系统开发-最新利用浏览器的cookie 做历史浏览记录

  注意: 代码 放在要显示的为 (一般放在详情页),注意本教程不入库,直接利用浏览器的 cookie 缓存判断    <!--历史浏览记录 S--> <div class="column_box mt_10"> <div class="column_title">历史浏览记录</div> <div class="box_body_new"> <?php $MOD_name = &