lzx02 6 months ago
parent 498d98177d
commit 35f89ffa8b

8
.idea/.gitignore vendored

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1 @@
manage.py

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.8 (server)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>

@ -0,0 +1,52 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
</code_scheme>
</component>

@ -0,0 +1,452 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DBNavigator.Project.DataEditorManager">
<record-view-column-sorting-type value="BY_INDEX" />
<value-preview-text-wrapping value="true" />
<value-preview-pinned value="false" />
</component>
<component name="DBNavigator.Project.DataExportManager">
<export-instructions>
<create-header value="true" />
<quote-values-containing-separator value="true" />
<quote-all-values value="false" />
<value-separator value="" />
<file-name value="" />
<file-location value="" />
<scope value="GLOBAL" />
<destination value="FILE" />
<format value="EXCEL" />
<charset value="GBK" />
</export-instructions>
</component>
<component name="DBNavigator.Project.DatabaseBrowserManager">
<autoscroll-to-editor value="false" />
<autoscroll-from-editor value="true" />
<show-object-properties value="true" />
<loaded-nodes />
</component>
<component name="DBNavigator.Project.DatabaseFileManager">
<open-files />
</component>
<component name="DBNavigator.Project.EditorStateManager">
<last-used-providers />
</component>
<component name="DBNavigator.Project.MethodExecutionManager">
<method-browser />
<execution-history>
<group-entries value="true" />
<execution-inputs />
</execution-history>
<argument-values-cache />
</component>
<component name="DBNavigator.Project.ObjectDependencyManager">
<last-used-dependency-type value="INCOMING" />
</component>
<component name="DBNavigator.Project.ObjectQuickFilterManager">
<last-used-operator value="EQUAL" />
<filters />
</component>
<component name="DBNavigator.Project.ScriptExecutionManager" clear-outputs="true">
<recently-used-interfaces />
</component>
<component name="DBNavigator.Project.Settings">
<connections />
<browser-settings>
<general>
<display-mode value="TABBED" />
<navigation-history-size value="100" />
<show-object-details value="false" />
</general>
<filters>
<object-type-filter>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="true" />
<object-type name="ROLE" enabled="true" />
<object-type name="PRIVILEGE" enabled="true" />
<object-type name="CHARSET" enabled="true" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED_VIEW" enabled="true" />
<object-type name="NESTED_TABLE" enabled="true" />
<object-type name="COLUMN" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET_TRIGGER" enabled="true" />
<object-type name="DATABASE_TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="true" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="TYPE_ATTRIBUTE" enabled="true" />
<object-type name="ARGUMENT" enabled="true" />
<object-type name="DIMENSION" enabled="true" />
<object-type name="CLUSTER" enabled="true" />
<object-type name="DBLINK" enabled="true" />
</object-type-filter>
</filters>
<sorting>
<object-type name="COLUMN" sorting-type="NAME" />
<object-type name="FUNCTION" sorting-type="NAME" />
<object-type name="PROCEDURE" sorting-type="NAME" />
<object-type name="ARGUMENT" sorting-type="POSITION" />
</sorting>
<default-editors>
<object-type name="VIEW" editor-type="SELECTION" />
<object-type name="PACKAGE" editor-type="SELECTION" />
<object-type name="TYPE" editor-type="SELECTION" />
</default-editors>
</browser-settings>
<navigation-settings>
<lookup-filters>
<lookup-objects>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="false" />
<object-type name="ROLE" enabled="false" />
<object-type name="PRIVILEGE" enabled="false" />
<object-type name="CHARSET" enabled="false" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED VIEW" enabled="true" />
<object-type name="NESTED TABLE" enabled="false" />
<object-type name="COLUMN" enabled="false" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET TRIGGER" enabled="true" />
<object-type name="DATABASE TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="false" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="TYPE ATTRIBUTE" enabled="false" />
<object-type name="ARGUMENT" enabled="false" />
<object-type name="DIMENSION" enabled="false" />
<object-type name="CLUSTER" enabled="false" />
<object-type name="DBLINK" enabled="true" />
</lookup-objects>
<force-database-load value="false" />
<prompt-connection-selection value="true" />
<prompt-schema-selection value="true" />
</lookup-filters>
</navigation-settings>
<dataset-grid-settings>
<general>
<enable-zooming value="true" />
<enable-column-tooltip value="true" />
</general>
<sorting>
<nulls-first value="true" />
<max-sorting-columns value="4" />
</sorting>
<tracking-columns>
<columnNames value="" />
<visible value="true" />
<editable value="false" />
</tracking-columns>
</dataset-grid-settings>
<dataset-editor-settings>
<text-editor-popup>
<active value="false" />
<active-if-empty value="false" />
<data-length-threshold value="100" />
<popup-delay value="1000" />
</text-editor-popup>
<values-actions-popup>
<show-popup-button value="true" />
<element-count-threshold value="1000" />
<data-length-threshold value="250" />
</values-actions-popup>
<general>
<fetch-block-size value="100" />
<fetch-timeout value="30" />
<trim-whitespaces value="true" />
<convert-empty-strings-to-null value="true" />
<select-content-on-cell-edit value="true" />
<large-value-preview-active value="true" />
</general>
<filters>
<prompt-filter-dialog value="true" />
<default-filter-type value="BASIC" />
</filters>
<qualified-text-editor text-length-threshold="300">
<content-types>
<content-type name="Text" enabled="true" />
<content-type name="Properties" enabled="true" />
<content-type name="XML" enabled="true" />
<content-type name="DTD" enabled="true" />
<content-type name="HTML" enabled="true" />
<content-type name="XHTML" enabled="true" />
<content-type name="SQL" enabled="true" />
<content-type name="PL/SQL" enabled="true" />
<content-type name="YAML" enabled="true" />
</content-types>
</qualified-text-editor>
<record-navigation>
<navigation-target value="VIEWER" />
</record-navigation>
</dataset-editor-settings>
<code-editor-settings>
<general>
<show-object-navigation-gutter value="false" />
<show-spec-declaration-navigation-gutter value="true" />
<enable-spellchecking value="true" />
<enable-reference-spellchecking value="false" />
</general>
<confirmations>
<save-changes value="false" />
<revert-changes value="true" />
</confirmations>
</code-editor-settings>
<code-completion-settings>
<filters>
<basic-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="false" />
<filter-element type="OBJECT" id="view" selected="false" />
<filter-element type="OBJECT" id="materialized view" selected="false" />
<filter-element type="OBJECT" id="index" selected="false" />
<filter-element type="OBJECT" id="constraint" selected="false" />
<filter-element type="OBJECT" id="trigger" selected="false" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="false" />
<filter-element type="OBJECT" id="procedure" selected="false" />
<filter-element type="OBJECT" id="function" selected="false" />
<filter-element type="OBJECT" id="package" selected="false" />
<filter-element type="OBJECT" id="type" selected="false" />
<filter-element type="OBJECT" id="dimension" selected="false" />
<filter-element type="OBJECT" id="cluster" selected="false" />
<filter-element type="OBJECT" id="dblink" selected="false" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</basic-filter>
<extended-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</extended-filter>
</filters>
<sorting enabled="true">
<sorting-element type="RESERVED_WORD" id="keyword" />
<sorting-element type="RESERVED_WORD" id="datatype" />
<sorting-element type="OBJECT" id="column" />
<sorting-element type="OBJECT" id="table" />
<sorting-element type="OBJECT" id="view" />
<sorting-element type="OBJECT" id="materialized view" />
<sorting-element type="OBJECT" id="index" />
<sorting-element type="OBJECT" id="constraint" />
<sorting-element type="OBJECT" id="trigger" />
<sorting-element type="OBJECT" id="synonym" />
<sorting-element type="OBJECT" id="sequence" />
<sorting-element type="OBJECT" id="procedure" />
<sorting-element type="OBJECT" id="function" />
<sorting-element type="OBJECT" id="package" />
<sorting-element type="OBJECT" id="type" />
<sorting-element type="OBJECT" id="dimension" />
<sorting-element type="OBJECT" id="cluster" />
<sorting-element type="OBJECT" id="dblink" />
<sorting-element type="OBJECT" id="schema" />
<sorting-element type="OBJECT" id="role" />
<sorting-element type="OBJECT" id="user" />
<sorting-element type="RESERVED_WORD" id="function" />
<sorting-element type="RESERVED_WORD" id="parameter" />
</sorting>
<format>
<enforce-code-style-case value="true" />
</format>
</code-completion-settings>
<execution-engine-settings>
<statement-execution>
<fetch-block-size value="100" />
<execution-timeout value="20" />
<debug-execution-timeout value="600" />
<focus-result value="false" />
<prompt-execution value="false" />
</statement-execution>
<script-execution>
<command-line-interfaces />
<execution-timeout value="300" />
</script-execution>
<method-execution>
<execution-timeout value="30" />
<debug-execution-timeout value="600" />
<parameter-history-size value="10" />
</method-execution>
</execution-engine-settings>
<operation-settings>
<transactions>
<uncommitted-changes>
<on-project-close value="ASK" />
<on-disconnect value="ASK" />
<on-autocommit-toggle value="ASK" />
</uncommitted-changes>
<multiple-uncommitted-changes>
<on-commit value="ASK" />
<on-rollback value="ASK" />
</multiple-uncommitted-changes>
</transactions>
<session-browser>
<disconnect-session value="ASK" />
<kill-session value="ASK" />
<reload-on-filter-change value="false" />
</session-browser>
<compiler>
<compile-type value="KEEP" />
<compile-dependencies value="ASK" />
<always-show-controls value="false" />
</compiler>
<debugger>
<debugger-type value="JDBC" />
<use-generic-runners value="true" />
</debugger>
</operation-settings>
<ddl-file-settings>
<extensions>
<mapping file-type-id="VIEW" extensions="vw" />
<mapping file-type-id="TRIGGER" extensions="trg" />
<mapping file-type-id="PROCEDURE" extensions="prc" />
<mapping file-type-id="FUNCTION" extensions="fnc" />
<mapping file-type-id="PACKAGE" extensions="pkg" />
<mapping file-type-id="PACKAGE_SPEC" extensions="pks" />
<mapping file-type-id="PACKAGE_BODY" extensions="pkb" />
<mapping file-type-id="TYPE" extensions="tpe" />
<mapping file-type-id="TYPE_SPEC" extensions="tps" />
<mapping file-type-id="TYPE_BODY" extensions="tpb" />
</extensions>
<general>
<lookup-ddl-files value="true" />
<create-ddl-files value="false" />
<synchronize-ddl-files value="true" />
<use-qualified-names value="false" />
<make-scripts-rerunnable value="true" />
</general>
</ddl-file-settings>
<general-settings>
<regional-settings>
<date-format value="MEDIUM" />
<number-format value="UNGROUPED" />
<locale value="SYSTEM_DEFAULT" />
<use-custom-formats value="false" />
</regional-settings>
<environment>
<environment-types>
<environment-type id="development" name="Development" description="Development environment" color="-2430209/-12296320" readonly-code="false" readonly-data="false" />
<environment-type id="integration" name="Integration" description="Integration environment" color="-2621494/-12163514" readonly-code="true" readonly-data="false" />
<environment-type id="production" name="Production" description="Productive environment" color="-11574/-10271420" readonly-code="true" readonly-data="true" />
<environment-type id="other" name="Other" description="" color="-1576/-10724543" readonly-code="false" readonly-data="false" />
</environment-types>
<visibility-settings>
<connection-tabs value="true" />
<dialog-headers value="true" />
<object-editor-tabs value="true" />
<script-editor-tabs value="false" />
<execution-result-tabs value="true" />
</visibility-settings>
</environment>
</general-settings>
</component>
<component name="DBNavigator.Project.StatementExecutionManager">
<execution-variables />
</component>
</project>

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.8 (server)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (server)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/back_admin.iml" filepath="$PROJECT_DIR$/.idea/back_admin.iml" />
</modules>
</component>
</project>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/django" vcs="Git" />
</component>
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

@ -0,0 +1,2 @@
import pymysql
pymysql.install_as_MySQLdb()

@ -0,0 +1,125 @@
"""
Django settings for back_admin project.
Generated by 'django-admin startproject' using Django 2.2.6.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'v!%3kv3(=4@$#^iov#9zt3-=m%oko00&@s^@-l^1%omeewptp*'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['http://127.0.0.1:80/admin', '127.1', '127.0.0.1', 'localhost', '1.17.0.1']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'user',
]
# 自定义用户model
AUTH_USER_MODEL = 'user.User'
#AUTH_USER_MODEL = 'user.Catagory'
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'back_admin.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'back_admin.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
DEFAULT_CHARSET = 'utf-8'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'video',
'USER': 'root',
'PASSWORD': '123456',
'HOST': 'localhost',
'PORT': '3306',
'OPTIONS': {
'charset': 'utf8',
},
}
}
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'

@ -0,0 +1,23 @@
"""back_admin URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')
"""
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls), # Django自带的管理后台
# 引入你的应用的URL配置
]

@ -0,0 +1,16 @@
"""
WSGI config for back_admin project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'back_admin.settings')
application = get_wsgi_application()

@ -0,0 +1 @@
Subproject commit 498d98177d97e5fb11aa6a07cc294586997443c7

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 KiB

@ -0,0 +1,20 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'back_admin.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
sys.exit(0)
if __name__ == '__main__':
main()

@ -0,0 +1,4 @@
输入命令python manage.py runserver
访问路径http://127.0.0.1:8000/admin/
用户名admin
密码admin

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

@ -0,0 +1,66 @@
from django.contrib import admin
# Register your models here.
from user.models import *
# 用户
class UserAdmin(admin.ModelAdmin):
fields = ('username', 'account', 'password', 'email', 'u_image')
list_display = ('username', 'account', 'password', 'email', 'u_image')
# 视频
class VideoAdmin(admin.ModelAdmin):
list_display = ('videoid', 'sectionname', 'time', 'courseid')
list_editable = ('time',)
# 课程
class CourseAdmin(admin.ModelAdmin):
list_display = ('name', 'author', 'intro', 'v_image', 'viewnum', 'likenum', 'collectnum', 'coursefile')
readonly_fields = ('viewnum', 'likenum', 'collectnum')
# list_display_links = ('coursefile',)
list_filter = ('name',)
fieldsets = (
(None, {
'fields': (
'name', 'author', 'intro', 'v_image', 'viewnum', 'likenum', 'collectnum', 'coursefile', 'sumtime')
}),
('高级设置', {
'classes': ('collapse',),
'fields': ('collegeid', 'classifyid')
})
)
# 大学
class CollegeAdmin(admin.ModelAdmin):
list_display = ('name', 'intro', 'logo', 'co_image', 'schoolbadge')
class MaterialInline(admin.TabularInline):
model = Material
class CourseInline(admin.TabularInline):
model = Course
# 分类
class ClassifyAdmin(admin.ModelAdmin):
inlines = [MaterialInline,CourseInline]
list_display = ('name', 'intro')
# 资料
class MaterialAdmin(admin.ModelAdmin):
list_display = ('name', 'author', 'intro', 'downloadnum')
admin.site.register(User, UserAdmin)
admin.site.register(Classify, ClassifyAdmin)
admin.site.register(Video, VideoAdmin)
admin.site.register(College, CollegeAdmin)
admin.site.register(Material, MaterialAdmin)
admin.site.register(Course, CourseAdmin)

@ -0,0 +1,5 @@
from django.apps import AppConfig
class UserConfig(AppConfig):
name = 'user'

@ -0,0 +1,138 @@
# Generated by Django 2.2.6 on 2019-11-12 12:42
from django.conf import settings
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('username', models.CharField(blank=True, max_length=150, unique=True, verbose_name='用户名')),
('account', models.CharField(default='', max_length=20, verbose_name='账号')),
('password', models.CharField(max_length=150, verbose_name='密码')),
('email', models.CharField(max_length=20, null=True, verbose_name='邮箱')),
('u_image', models.CharField(default='', max_length=20, verbose_name='头像')),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],
options={
'verbose_name': '用户',
'verbose_name_plural': '用户',
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
migrations.CreateModel(
name='Classify',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=30, verbose_name='分类名称')),
('intro', models.CharField(max_length=100, verbose_name='分类简介')),
],
options={
'verbose_name': '分类',
'verbose_name_plural': '分类',
},
),
migrations.CreateModel(
name='College',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=20, verbose_name='大学名称')),
('intro', models.CharField(max_length=50, verbose_name='大学简介')),
('logo', models.CharField(max_length=50, verbose_name='大学 logo')),
('co_image', models.CharField(max_length=50, verbose_name='大学图片')),
('schoolbadge', models.CharField(max_length=50, verbose_name='大学背景图片')),
],
options={
'verbose_name': '大学',
'verbose_name_plural': '大学',
},
),
migrations.CreateModel(
name='Course',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=20, verbose_name='课程名称')),
('author', models.CharField(max_length=20, verbose_name='作者')),
('intro', models.CharField(max_length=50, verbose_name='课程简介')),
('v_image', models.CharField(max_length=30, verbose_name='课程图片地址')),
('viewnum', models.IntegerField(verbose_name='观看数量')),
('likenum', models.IntegerField(verbose_name='点赞数量')),
('collectnum', models.IntegerField(verbose_name='收藏数量')),
('coursefile', models.CharField(max_length=30, verbose_name='课件')),
('sumtime', models.IntegerField(verbose_name='课程总时长')),
('classifyid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Classify')),
('collegeid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.College')),
],
options={
'verbose_name': '课程',
'verbose_name_plural': '课程',
},
),
migrations.CreateModel(
name='Video',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('videoid', models.CharField(max_length=30, verbose_name='视频地址')),
('sectionname', models.CharField(max_length=30, verbose_name='视频章节名称')),
('time', models.CharField(max_length=20, verbose_name='视频时长')),
('courseid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Course')),
],
options={
'verbose_name': '视频',
'verbose_name_plural': '视频',
},
),
migrations.CreateModel(
name='Material',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=20, verbose_name='资料名称')),
('author', models.CharField(max_length=20, verbose_name='作者')),
('intro', models.CharField(max_length=50, verbose_name='资料简介')),
('downloadnum', models.IntegerField(verbose_name='下载数量')),
('m_image', models.CharField(max_length=20, verbose_name='资料简介')),
('classifyid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Classify')),
],
options={
'verbose_name': '资料',
'verbose_name_plural': '资料',
},
),
migrations.CreateModel(
name='History',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('historytime', models.CharField(max_length=50, null=True, verbose_name='历史时间')),
('collect', models.BooleanField(default=False, verbose_name='收藏')),
('userid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('videoid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Video')),
],
options={
'verbose_name': '观看历史',
'verbose_name_plural': '观看历史',
},
),
]

@ -0,0 +1,55 @@
# Generated by Django 2.2.6 on 2019-11-13 08:03
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('user', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='course',
name='classifyid',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Classify', verbose_name='所属分类'),
),
migrations.AlterField(
model_name='course',
name='collegeid',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.College', verbose_name='所属大学'),
),
migrations.AlterField(
model_name='history',
name='userid',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='所属用户'),
),
migrations.AlterField(
model_name='history',
name='videoid',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Video', verbose_name='所属视频'),
),
migrations.AlterField(
model_name='material',
name='classifyid',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Classify', verbose_name='所属分类'),
),
migrations.AlterField(
model_name='material',
name='m_image',
field=models.CharField(max_length=20, verbose_name='资料图片'),
),
migrations.AlterField(
model_name='user',
name='u_image',
field=models.ImageField(default='', upload_to='avatar/%Y/%m', verbose_name='头像图片路径'),
),
migrations.AlterField(
model_name='video',
name='courseid',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.Course', verbose_name='所设课程'),
),
]

@ -0,0 +1,18 @@
# Generated by Django 2.2.6 on 2019-11-13 08:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0002_auto_20191113_1603'),
]
operations = [
migrations.AlterField(
model_name='user',
name='u_image',
field=models.ImageField(height_field='url_height', upload_to='icons', verbose_name='头像图片路径', width_field='url_width'),
),
]

@ -0,0 +1,18 @@
# Generated by Django 2.2.6 on 2019-11-13 08:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0003_auto_20191113_1613'),
]
operations = [
migrations.AlterField(
model_name='user',
name='u_image',
field=models.ImageField(height_field='url_height', upload_to='uploads/%Y/%m/%d/', verbose_name='头像图片路径', width_field='url_width'),
),
]

@ -0,0 +1,115 @@
# -*-coding:utf-8-*-
from django.contrib.auth.models import AbstractUser
from django.db import models
# Create your models here.
class User(AbstractUser):
username = models.CharField(max_length=150, blank=True, null=False, unique=True, verbose_name='用户名')
account = models.CharField(max_length=20, default='', verbose_name="账号")
password = models.CharField(max_length=150, null=False, verbose_name="密码")
email = models.CharField(max_length=20, verbose_name="邮箱", null=True)
u_image = models.ImageField(upload_to='avatar/%Y/%m', default='avatar/default.png', verbose_name="头像图片路径" )
class Meta:
verbose_name = "用户"
verbose_name_plural = verbose_name
def __unicode__(self):
return self.username
class Classify(models.Model):
name = models.CharField(max_length=30, verbose_name='分类名称')
intro = models.CharField(max_length=100, verbose_name='分类简介')
class Meta:
verbose_name = "分类"
verbose_name_plural = verbose_name
def __unicode__(self):
return self.name
class College(models.Model):
name = models.CharField(max_length=20, verbose_name='大学名称')
intro = models.CharField(max_length=50, verbose_name='大学简介')
logo = models.CharField(max_length=50, verbose_name='大学 logo')
co_image = models.CharField(max_length=50, verbose_name='大学图片')
schoolbadge = models.CharField(max_length=50, verbose_name='大学背景图片')
class Meta:
verbose_name = "大学"
verbose_name_plural = verbose_name
def __unicode__(self):
return self.name
class Material(models.Model):
name = models.CharField(max_length=20, verbose_name='资料名称')
author = models.CharField(max_length=20, verbose_name='作者')
intro = models.CharField(max_length=50, verbose_name='资料简介')
downloadnum = models.IntegerField(verbose_name='下载数量')
m_image = models.CharField(max_length=20, verbose_name='资料图片')
classifyid = models.ForeignKey(to=Classify, on_delete=models.CASCADE,verbose_name='所属分类')
class Meta:
verbose_name = "资料"
verbose_name_plural = verbose_name
def __unicode__(self):
return self.name
class Course(models.Model):
name = models.CharField(max_length=20, verbose_name='课程名称')
author = models.CharField(max_length=20, verbose_name='作者')
intro = models.CharField(max_length=50, verbose_name='课程简介')
v_image = models.CharField(max_length=30, verbose_name='课程图片地址')
viewnum = models.IntegerField(verbose_name='观看数量',null=True )
likenum = models.IntegerField(verbose_name='点赞数量',null=True)
collectnum = models.IntegerField(verbose_name='收藏数量',null=True)
coursefile = models.CharField(max_length=30, verbose_name='课件')
sumtime = models.IntegerField(verbose_name='课程总时长')
collegeid = models.ForeignKey(to=College, on_delete=models.CASCADE, verbose_name='所属大学')
classifyid = models.ForeignKey(to=Classify, on_delete=models.CASCADE,verbose_name='所属分类')
class Meta:
verbose_name = "课程"
verbose_name_plural = verbose_name
def __unicode__(self):
return self.name
class Video(models.Model):
videoid = models.CharField(max_length=30, verbose_name='视频地址')
sectionname = models.CharField(max_length=30, verbose_name='视频章节名称')
time = models.CharField(max_length=20, verbose_name='视频时长')
courseid = models.ForeignKey(to=Course, on_delete=models.CASCADE,verbose_name='所设课程')
class Meta:
verbose_name = "视频"
verbose_name_plural = verbose_name
def __unicode__(self):
return self.sectionname
class History(models.Model):
historytime = models.CharField(max_length=50, verbose_name="历史时间", null=True)
collect = models.BooleanField(verbose_name="收藏", default=False)
userid = models.ForeignKey(to=User, on_delete=models.CASCADE,verbose_name='所属用户')
videoid = models.ForeignKey(to=Video, on_delete=models.CASCADE,verbose_name='所属视频')
class Meta:
verbose_name = "观看历史"
verbose_name_plural = verbose_name
def __unicode__(self):
return self.collect

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

@ -0,0 +1,150 @@
/*
Navicat MySQL Data Transfer
Source Server : mybase
Source Server Version : 80003
Source Host : localhost:3306
Source Database : video
Target Server Type : MYSQL
Target Server Version : 80003
File Encoding : 65001
Date: 2020-02-19 15:02:34
*/
SET FOREIGN_KEY_CHECKS=0;
USE video;
-- ----------------------------
-- Table structure for classify1
-- ----------------------------
DROP TABLE IF EXISTS `classify1`;
CREATE TABLE `classify1` (
`oneid` int(11) NOT NULL,
`onename` varchar(10) NOT NULL,
`intro` varchar(50) DEFAULT NULL,
PRIMARY KEY (`oneid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of classify1
-- ----------------------------
-- ----------------------------
-- Table structure for college
-- ----------------------------
DROP TABLE IF EXISTS `college`;
CREATE TABLE `college` (
`coid` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
`intro` varchar(50) NOT NULL,
`logo` varchar(60) NOT NULL,
`co_image` varchar(60) NOT NULL,
`schoolbadge` varchar(60) DEFAULT NULL,
PRIMARY KEY (`coid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of college
-- ----------------------------
-- ----------------------------
-- Table structure for course
-- ----------------------------
DROP TABLE IF EXISTS `course`;
CREATE TABLE `course` (
`vid` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
`author` varchar(15) DEFAULT NULL,
`intro` varchar(50) NOT NULL,
`v_image` varchar(60) NOT NULL,
`viewnum` int(11) DEFAULT NULL,
`likenum` int(11) DEFAULT NULL,
`collectnum` int(11) DEFAULT NULL,
`courseware` varchar(50) DEFAULT NULL,
`sum` int(11) DEFAULT NULL,
`clid` int(11) NOT NULL,
`coid` int(11) DEFAULT NULL,
`oneid` int(11) DEFAULT NULL,
PRIMARY KEY (`vid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of course
-- ----------------------------
-- ----------------------------
-- Table structure for history
-- ----------------------------
DROP TABLE IF EXISTS `history`;
CREATE TABLE `history` (
`hid` int(11) NOT NULL AUTO_INCREMENT,
`historytime` varchar(50) NOT NULL,
`collect` tinyint(1) NOT NULL,
`uid` int(11) NOT NULL,
`vid` int(11) NOT NULL,
PRIMARY KEY (`hid`),
KEY `uid` (`uid`),
KEY `vid` (`vid`),
CONSTRAINT `uid` FOREIGN KEY (`uid`) REFERENCES `user` (`uid`),
CONSTRAINT `vid` FOREIGN KEY (`vid`) REFERENCES `course` (`vid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of history
-- ----------------------------
-- ----------------------------
-- Table structure for material
-- ----------------------------
DROP TABLE IF EXISTS `material`;
CREATE TABLE `material` (
`mid` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
`acthor` varchar(15) DEFAULT NULL,
`intro` varchar(50) NOT NULL,
`downloadnum` int(11) DEFAULT NULL,
`m_image` varchar(60) DEFAULT NULL,
`oneid` int(11) NOT NULL,
PRIMARY KEY (`mid`),
KEY `classifyid` (`oneid`),
CONSTRAINT `classifyid` FOREIGN KEY (`oneid`) REFERENCES `classify1` (`oneid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of material
-- ----------------------------
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(20) NOT NULL,
`account` varchar(15) NOT NULL,
`password` varchar(20) NOT NULL,
`email` varchar(30) DEFAULT NULL,
`u_image` varchar(60) DEFAULT NULL,
PRIMARY KEY (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user
-- ----------------------------
-- ----------------------------
-- Table structure for video
-- ----------------------------
DROP TABLE IF EXISTS `video`;
CREATE TABLE `video` (
`vid` int(11) NOT NULL,
`videoId` varchar(50) NOT NULL,
`sectionname` varchar(30) DEFAULT NULL,
`time` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of video
-- ----------------------------
Loading…
Cancel
Save