後台管理布局之模板繼承

2021-08-07 10:40:49 字數 2106 閱讀 6737

後台管理布局中分

-----上-------

左     ====

= 右=

====

預設的管理介面 左側跟上方的區域不做任何變動

對於右側區域  支援滾動  css新增

overflow:scroll;
對於右側區域的內容  進行繼承
父級的base.html新增模板語言

子檔案使用extends直接繼承

<

formaction="">

<

p><

inputtype="text">

賬號p>

form>

如果父級base.html有檔案內容 則會被覆蓋掉
完整**內容如下:
urls.py
"""s17day17 url configuration

the `urlpatterns` list routes urls to views. for more information please see:

examples:

function views

2. add a url to urlpatterns: url(r'^$', views.home, name='home')

class-based views

2. add a url to urlpatterns: url(r'^$', home.as_view(), name='home')

including another urlconf

1. import the include() function: from django.conf.urls import url, include

2. add a url to urlpatterns: url(r'^blog/', include('blog.urls'))

"""from django.conf.urls import url

from django.contrib import admin

urlpatterns = [

url(r'^admin/', admin.site.urls),

url(r'^index/', views.index),

url(r'^addarticle/', views.addarticle),

]

views.py檔案內容
from django.shortcuts import render,httpresponse

return render(request,"後台管理布局.html",locals())

def addarticle(request):

return render(request,"addarticle.html")

base.html檔案內容

新增文章

addarticle.html內容

後台管理布局.html 即index檔案

新增文章

模板布局 繼承

乙個 的多個頁面往往有著相同的頁首和頁尾,每次都重新編寫效率就很低,這個時候利用模板繼承就很有效了。1 首先編寫乙個templates資料夾下的news.html模板 lang en xmlns th head th fragment header th text h div body html 2...

後台管理頁面布局

簡單的乙個頁面布局,頭部 左側選單欄,右側內容,頭部和選單欄固定位置,內容部分如果很長就會出現滾動條 兩種方法能實現,其實兩種差別只有乙個屬性不一樣。1.1 使用position fixed 1.先定義三個div標籤 2.設定頭部樣式,高48px,背景色藍色 頂部出現乙個藍色長條 3.在pg con...

bootstrap後台管理模板

adminlte演示 gentelella admin演示 vali admin演示 modularadmin演示 metis演示 ace演示 light bootstrap dashboard light bootstrap dashboard是乙個建立在bootstrap3之上的 完全響應的管理...