zoukankan      html  css  js  c++  java
  • adminset 首页

    1.登录http://192.168.137.4:9000
    
    
    
    2.
    [root@adminset adminset]# vim urls.py
    
    from django.conf.urls import include, url
    from django.contrib import admin
    from django.conf import settings
    from adminset.views import index
    
    urlpatterns = [
        url(r'^$', index,name='index'),
    
    
    3.
    [root@adminset adminset]# vim views.py
    
    #! /usr/bin/env python
    # -*- coding: utf-8 -*-
    
    from django.shortcuts import redirect
    
    
    def index(request):
        return redirect('/navi/')
    
    4.
    [root@adminset adminset]# vim urls.py
    
    from django.conf.urls import include, url
    from django.contrib import admin
    from django.conf import settings
    from adminset.views import index
    
    urlpatterns = [
        url(r'^$', index,name='index'),
        url(r'^cmdb/', include('cmdb.urls')),
        url(r'^navi/', include('navi.urls')),
    
    5.
    [root@adminset navi]# vim urls.py
    
    #! /usr/bin/env python
    # -*- coding: utf-8 -*-
    from django.conf.urls import url, include
    from navi import views
    
    urlpatterns = [
        url(r'^$', views.index, name='navi'),
    
    6.
    @permission_verify()
    def index(request):
        print '---call navi/index--------'
        temp_name = "navi/navi-header.html"
        allnavi = navi.objects.all()
        print allnavi
        return render(request, "navi/index.html", locals())
    
    7.
    [root@adminset templates]# cat navi/index.html
    {% extends 'base.html' %}
    {% block content %}
    <script>
        window.onload=init;
        function init() {
            showhide(1);
        }
        function showhide(n) {
            var box = document.getElementById("navi");
            box.className="active";
        }
    </script>
    
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
    
        </section>
    
        <!-- Main content -->
        <section class="content">
        <div>
            <div class="box-body" >
            {% if not allnavi %}
                <a href="{% url 'add' %}"><span class="btn btn-default" ><b>添加一个导航</b> <i class="fa fa-plus"></i></span></a>
            {% endif %}
            {% if allnavi %}
                {% for navi in allnavi %}
                    <a href="{{ navi.url }}" target="_blank">
                        <div class="col-md-3" >
                          <div class="box box-info">
                            <div class="box-header with-border">
                              <h3 class="box-title" >{{ navi.name }}</h3>
                            </div><!-- /.box-header -->
                            <div class="box-body">
                              {{ navi.description }}
                            </div><!-- /.box-body -->
                          </div><!-- /.box -->
                        </div>
                    </a>
                {% endfor %}
            {% endif %}
            </div>
            <!-- /.box-body -->
            <!-- /.box-footer-->
          </div>
    
          <!-- Your Page Content Here -->
        </section>
        <!-- /.content -->
      </div>
      
     8. base.html 又引用了
     
     9.  {% include 'main-sidebar.html' %}
  • 相关阅读:
    嗅探对方机器,获取机器键盘记录
    python识别图片生成字符模式
    栈 详解
    解决 No result defined for action and result input 异常
    解决hibernate保存数据到mysql中出现乱码问题
    懒加载异常 org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role
    解决springjava.lang.IllegalStateException: BeanFactory not initialized or already closed
    Android Fragment 详解
    脏读|不可重复度|幻读的理解以及Spring定义的五种事务隔离级别
    Spring中的context:annotation-config作用
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349005.html
Copyright © 2011-2022 走看看