Project full text index
『Python-Django Personal home page 』 Open source project overview
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
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
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