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元组、列表、字典
    测试通过Word直接发布博文
    Python环境搭建(windows)
    hdu 4003 Find Metal Mineral 树形DP
    poj 1986 Distance Queries LCA
    poj 1470 Closest Common Ancestors LCA
    poj 1330 Nearest Common Ancestors LCA
    hdu 3046 Pleasant sheep and big big wolf 最小割
    poj 3281 Dining 最大流
    zoj 2760 How Many Shortest Path 最大流
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349005.html
Copyright © 2011-2022 走看看