程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python Django personal homepage 4 Application development of personal data back-end management

編輯:Python

Project full text index

『Python-Django Personal home page 』 Open source project overview

List of articles

  • Application creation & To configure
  • management adminx.py

In order to facilitate the future expansion of the functions of the personal home page , There will be adminx The background management configuration of is placed in a separate apps Under application .

Application creation & To configure

Application creation

CMD Command line to create navigation data application , And move the created application folder to apps Then you can .

cd MyHome
python manage.py startapp Configuration

Application configuration

stay settings.py Add an application name to INSTALLED_APPS .

INSTALLED_APPS = [
...
'apps.Configuration',

Other documents

  • admin.py Due to the use xadmin Replace the original version of admin, So it was renamed adminx.py.

management adminx.py

Develop data model application management according to project requirements .

# -*- coding: utf-8 -*-
__author__ = 'Mr Data Yang '
__explain__ = ' My home page adminx Background configuration file '
from apps.MyHomePage.adminx import *
import xadmin
from xadmin import views
# xadmin Background global settings The theme function is enabled 
class BaseSetting(object):
enable_themes = True # Enable background theme 
use_bootswatch = True # Switch theme mode 
# xadmin Background menu settings 
class GlobalSettings(object):
site_title = " My home page " # Set site title 
site_footer = "Mr Data Yang production " # Set the site's footers 
menu_style = "accordion" # Set menu collapse 
def get_site_menu(self):
MyHomePageMenu = {
'title': ' Home page management ', 'menus': (
{
'title': ' Personal introduction ', 'url': self.get_model_url(MyInformation, 'changelist')},
{
'title': ' education & Occupation List ', 'url': self.get_model_url(EducationExperienceList, 'changelist')},
{
'title': ' Service category ', 'url': self.get_model_url(MyServiceProjectType, 'changelist')},
{
'title': ' List of services ', 'url': self.get_model_url(MyServiceProjectList, 'changelist')},
{
'title': ' We media list ', 'url': self.get_model_url(MyBlogList, 'changelist')},
{
'title': ' Contact my information ', 'url': self.get_model_url(ContactMe, 'changelist')},
)}
return (
MyHomePageMenu,
)
xadmin.site.register(views.CommAdminView, GlobalSettings) # Global settings load 
xadmin.site.register(views.BaseAdminView, BaseSetting) # Register the main style switch 

The configuration of the home page function to be expanded in the future in the background is set here


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved