update studentmanagement

This commit is contained in:
lzh
2020-08-04 10:52:08 +08:00
parent 55dfc8be27
commit 34b466a4ab
38 changed files with 0 additions and 13336 deletions
-32
View File
@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="FacetManager">
<facet type="django" name="Django">
<configuration>
<option name="rootFolder" value="$MODULE_DIR$" />
<option name="settingsModule" value="Lib/settings.py" />
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
<option name="environment" value="&lt;map/&gt;" />
<option name="doNotUseTestRunner" value="false" />
<option name="trackFilePattern" value="migrations" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Django" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/main/templates" />
</list>
</option>
</component>
<component name="TestRunnerService">
<option name="projectConfiguration" value="pytest" />
<option name="PROJECT_TEST_RUNNER" value="pytest" />
</component>
</module>
-13
View File
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="dataSourceStorageLocal">
<data-source name="Django default" uuid="c4e431f8-0777-4d22-ab99-4a988603b107">
<database-info product="SQLite" version="3.25.1" jdbc-version="2.1" driver-name="SQLite JDBC" driver-version="3.25.1" dbms="SQLITE" exact-version="3.25.1" exact-driver-version="3.25">
<identifier-quote-string>&quot;</identifier-quote-string>
</database-info>
<case-sensitivity plain-identifiers="mixed" quoted-identifiers="mixed" />
<auth-required>false</auth-required>
<introspection-schemas>*:@</introspection-schemas>
</data-source>
</component>
</project>
-16
View File
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="Django default" uuid="c4e431f8-0777-4d22-ab99-4a988603b107">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<imported>true</imported>
<remarks>$PROJECT_DIR$/Lib/settings.py</remarks>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:E:\study\项目\Django-Projects\2016-course-DB-master\Lib\db.sqlite3</jdbc-url>
<driver-properties>
<property name="enable_load_extension" value="true" />
</driver-properties>
</data-source>
</component>
</project>
@@ -1,782 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<dataSource name="Django default">
<database-model serializer="dbm" dbms="SQLITE" family-id="SQLITE" format-version="4.15">
<root id="1">
<ServerVersion>3.25.1</ServerVersion>
</root>
<schema id="2" parent="1" name="main">
<Current>1</Current>
<Visible>1</Visible>
</schema>
<collation id="3" parent="1" name="BINARY"/>
<collation id="4" parent="1" name="NOCASE"/>
<collation id="5" parent="1" name="RTRIM"/>
<table id="6" parent="2" name="auth_group"/>
<table id="7" parent="2" name="auth_group_permissions"/>
<table id="8" parent="2" name="auth_permission"/>
<table id="9" parent="2" name="auth_user"/>
<table id="10" parent="2" name="auth_user_groups"/>
<table id="11" parent="2" name="auth_user_user_permissions"/>
<table id="12" parent="2" name="django_admin_log"/>
<table id="13" parent="2" name="django_content_type"/>
<table id="14" parent="2" name="django_migrations"/>
<table id="15" parent="2" name="django_session"/>
<table id="16" parent="2" name="main_additem"/>
<table id="17" parent="2" name="main_book"/>
<table id="18" parent="2" name="main_booknum"/>
<table id="19" parent="2" name="main_booktype"/>
<table id="20" parent="2" name="main_borrowitem"/>
<table id="21" parent="2" name="main_staffinfo"/>
<table id="22" parent="2" name="main_userinfo"/>
<table id="23" parent="2" name="sqlite_master">
<System>1</System>
</table>
<table id="24" parent="2" name="sqlite_sequence">
<System>1</System>
</table>
<column id="25" parent="6" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="26" parent="6" name="name">
<Position>2</Position>
<DataType>varchar(80)|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="27" parent="6" name="sqlite_autoindex_auth_group_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>name</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
<key id="28" parent="6">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<key id="29" parent="6">
<ColNames>name</ColNames>
<UnderlyingIndexName>sqlite_autoindex_auth_group_1</UnderlyingIndexName>
</key>
<column id="30" parent="7" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="31" parent="7" name="group_id">
<Position>2</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="32" parent="7" name="permission_id">
<Position>3</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="33" parent="7" name="sqlite_autoindex_auth_group_permissions_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>group_id
permission_id</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
<index id="34" parent="7" name="auth_group_permissions_0e939a4f">
<ColNames>group_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<index id="35" parent="7" name="auth_group_permissions_8373b171">
<ColNames>permission_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="36" parent="7">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<key id="37" parent="7">
<ColNames>group_id
permission_id</ColNames>
<UnderlyingIndexName>sqlite_autoindex_auth_group_permissions_1</UnderlyingIndexName>
</key>
<foreign-key id="38" parent="7">
<ColNames>group_id</ColNames>
<RefTableName>auth_group</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<foreign-key id="39" parent="7">
<ColNames>permission_id</ColNames>
<RefTableName>auth_permission</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<column id="40" parent="8" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="41" parent="8" name="name">
<Position>2</Position>
<DataType>varchar(50)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="42" parent="8" name="content_type_id">
<Position>3</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="43" parent="8" name="codename">
<Position>4</Position>
<DataType>varchar(100)|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="44" parent="8" name="sqlite_autoindex_auth_permission_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>content_type_id
codename</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
<index id="45" parent="8" name="auth_permission_417f1b1c">
<ColNames>content_type_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="46" parent="8">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<key id="47" parent="8">
<ColNames>content_type_id
codename</ColNames>
<UnderlyingIndexName>sqlite_autoindex_auth_permission_1</UnderlyingIndexName>
</key>
<foreign-key id="48" parent="8">
<ColNames>content_type_id</ColNames>
<RefTableName>django_content_type</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<column id="49" parent="9" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="50" parent="9" name="password">
<Position>2</Position>
<DataType>varchar(128)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="51" parent="9" name="last_login">
<Position>3</Position>
<DataType>datetime|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="52" parent="9" name="is_superuser">
<Position>4</Position>
<DataType>bool|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="53" parent="9" name="username">
<Position>5</Position>
<DataType>varchar(30)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="54" parent="9" name="first_name">
<Position>6</Position>
<DataType>varchar(30)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="55" parent="9" name="last_name">
<Position>7</Position>
<DataType>varchar(30)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="56" parent="9" name="email">
<Position>8</Position>
<DataType>varchar(75)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="57" parent="9" name="is_staff">
<Position>9</Position>
<DataType>bool|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="58" parent="9" name="is_active">
<Position>10</Position>
<DataType>bool|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="59" parent="9" name="date_joined">
<Position>11</Position>
<DataType>datetime|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="60" parent="9" name="sqlite_autoindex_auth_user_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>username</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
<key id="61" parent="9">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<key id="62" parent="9">
<ColNames>username</ColNames>
<UnderlyingIndexName>sqlite_autoindex_auth_user_1</UnderlyingIndexName>
</key>
<column id="63" parent="10" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="64" parent="10" name="user_id">
<Position>2</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="65" parent="10" name="group_id">
<Position>3</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="66" parent="10" name="sqlite_autoindex_auth_user_groups_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>user_id
group_id</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
<index id="67" parent="10" name="auth_user_groups_e8701ad4">
<ColNames>user_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<index id="68" parent="10" name="auth_user_groups_0e939a4f">
<ColNames>group_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="69" parent="10">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<key id="70" parent="10">
<ColNames>user_id
group_id</ColNames>
<UnderlyingIndexName>sqlite_autoindex_auth_user_groups_1</UnderlyingIndexName>
</key>
<foreign-key id="71" parent="10">
<ColNames>user_id</ColNames>
<RefTableName>auth_user</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<foreign-key id="72" parent="10">
<ColNames>group_id</ColNames>
<RefTableName>auth_group</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<column id="73" parent="11" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="74" parent="11" name="user_id">
<Position>2</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="75" parent="11" name="permission_id">
<Position>3</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="76" parent="11" name="sqlite_autoindex_auth_user_user_permissions_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>user_id
permission_id</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
<index id="77" parent="11" name="auth_user_user_permissions_e8701ad4">
<ColNames>user_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<index id="78" parent="11" name="auth_user_user_permissions_8373b171">
<ColNames>permission_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="79" parent="11">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<key id="80" parent="11">
<ColNames>user_id
permission_id</ColNames>
<UnderlyingIndexName>sqlite_autoindex_auth_user_user_permissions_1</UnderlyingIndexName>
</key>
<foreign-key id="81" parent="11">
<ColNames>user_id</ColNames>
<RefTableName>auth_user</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<foreign-key id="82" parent="11">
<ColNames>permission_id</ColNames>
<RefTableName>auth_permission</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<column id="83" parent="12" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="84" parent="12" name="action_time">
<Position>2</Position>
<DataType>datetime|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="85" parent="12" name="object_id">
<Position>3</Position>
<DataType>text|0s</DataType>
</column>
<column id="86" parent="12" name="object_repr">
<Position>4</Position>
<DataType>varchar(200)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="87" parent="12" name="action_flag">
<Position>5</Position>
<DataType>smallint unsigned|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="88" parent="12" name="change_message">
<Position>6</Position>
<DataType>text|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="89" parent="12" name="content_type_id">
<Position>7</Position>
<DataType>integer|0s</DataType>
</column>
<column id="90" parent="12" name="user_id">
<Position>8</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="91" parent="12" name="django_admin_log_417f1b1c">
<ColNames>content_type_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<index id="92" parent="12" name="django_admin_log_e8701ad4">
<ColNames>user_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="93" parent="12">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<foreign-key id="94" parent="12">
<ColNames>content_type_id</ColNames>
<RefTableName>django_content_type</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<foreign-key id="95" parent="12">
<ColNames>user_id</ColNames>
<RefTableName>auth_user</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<column id="96" parent="13" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="97" parent="13" name="name">
<Position>2</Position>
<DataType>varchar(100)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="98" parent="13" name="app_label">
<Position>3</Position>
<DataType>varchar(100)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="99" parent="13" name="model">
<Position>4</Position>
<DataType>varchar(100)|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="100" parent="13" name="sqlite_autoindex_django_content_type_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>app_label
model</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
<key id="101" parent="13">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<key id="102" parent="13">
<ColNames>app_label
model</ColNames>
<UnderlyingIndexName>sqlite_autoindex_django_content_type_1</UnderlyingIndexName>
</key>
<column id="103" parent="14" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="104" parent="14" name="app">
<Position>2</Position>
<DataType>varchar(255)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="105" parent="14" name="name">
<Position>3</Position>
<DataType>varchar(255)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="106" parent="14" name="applied">
<Position>4</Position>
<DataType>datetime|0s</DataType>
<NotNull>1</NotNull>
</column>
<key id="107" parent="14">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<column id="108" parent="15" name="session_key">
<Position>1</Position>
<DataType>varchar(40)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="109" parent="15" name="session_data">
<Position>2</Position>
<DataType>text|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="110" parent="15" name="expire_date">
<Position>3</Position>
<DataType>datetime|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="111" parent="15" name="sqlite_autoindex_django_session_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>session_key</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
<index id="112" parent="15" name="django_session_de54fa62">
<ColNames>expire_date</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="113" parent="15">
<ColNames>session_key</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_django_session_1</UnderlyingIndexName>
</key>
<column id="114" parent="16" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="115" parent="16" name="addNum">
<Position>2</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="116" parent="16" name="bookId_id">
<Position>3</Position>
<DataType>varchar(40)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="117" parent="16" name="staffId_id">
<Position>4</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="118" parent="16" name="main_additem_0ee13c1f">
<ColNames>bookId_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<index id="119" parent="16" name="main_additem_bea22849">
<ColNames>staffId_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="120" parent="16">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<foreign-key id="121" parent="16">
<ColNames>bookId_id</ColNames>
<RefTableName>main_book</RefTableName>
<RefColNames>bookId</RefColNames>
</foreign-key>
<foreign-key id="122" parent="16">
<ColNames>staffId_id</ColNames>
<RefTableName>main_staffinfo</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<column id="123" parent="17" name="bookId">
<Position>1</Position>
<DataType>varchar(40)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="124" parent="17" name="bookName">
<Position>2</Position>
<DataType>varchar(40)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="125" parent="17" name="bookPublisher">
<Position>3</Position>
<DataType>varchar(40)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="126" parent="17" name="bookAuthor">
<Position>4</Position>
<DataType>varchar(50)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="127" parent="17" name="bookIntroduction">
<Position>5</Position>
<DataType>text|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="128" parent="17" name="bookPrice">
<Position>6</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="129" parent="17" name="bookType_id">
<Position>7</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="130" parent="17" name="sqlite_autoindex_main_book_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>bookId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique>
</index>
<index id="131" parent="17" name="main_book_2ae59866">
<ColNames>bookType_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="132" parent="17">
<ColNames>bookId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_main_book_1</UnderlyingIndexName>
</key>
<foreign-key id="133" parent="17">
<ColNames>bookType_id</ColNames>
<RefTableName>main_booktype</RefTableName>
<RefColNames>TypeNum</RefColNames>
</foreign-key>
<column id="134" parent="18" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="135" parent="18" name="bookNum">
<Position>2</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="136" parent="18" name="bookId_id">
<Position>3</Position>
<DataType>varchar(40)|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="137" parent="18" name="main_booknum_0ee13c1f">
<ColNames>bookId_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="138" parent="18">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<foreign-key id="139" parent="18">
<ColNames>bookId_id</ColNames>
<RefTableName>main_book</RefTableName>
<RefColNames>bookId</RefColNames>
</foreign-key>
<column id="140" parent="19" name="TypeNum">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="141" parent="19" name="TypeName">
<Position>2</Position>
<DataType>varchar(20)|0s</DataType>
<NotNull>1</NotNull>
</column>
<key id="142" parent="19">
<ColNames>TypeNum</ColNames>
<Primary>1</Primary>
</key>
<column id="143" parent="20" name="borrowItemId">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="144" parent="20" name="hasReturned">
<Position>2</Position>
<DataType>bool|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="145" parent="20" name="bookId_id">
<Position>3</Position>
<DataType>varchar(40)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="146" parent="20" name="staffId_id">
<Position>4</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="147" parent="20" name="userId_id">
<Position>5</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="148" parent="20" name="main_borrowitem_0ee13c1f">
<ColNames>bookId_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<index id="149" parent="20" name="main_borrowitem_bea22849">
<ColNames>staffId_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<index id="150" parent="20" name="main_borrowitem_3491001b">
<ColNames>userId_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="151" parent="20">
<ColNames>borrowItemId</ColNames>
<Primary>1</Primary>
</key>
<foreign-key id="152" parent="20">
<ColNames>bookId_id</ColNames>
<RefTableName>main_book</RefTableName>
<RefColNames>bookId</RefColNames>
</foreign-key>
<foreign-key id="153" parent="20">
<ColNames>staffId_id</ColNames>
<RefTableName>main_staffinfo</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<foreign-key id="154" parent="20">
<ColNames>userId_id</ColNames>
<RefTableName>main_userinfo</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<column id="155" parent="21" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="156" parent="21" name="staffName">
<Position>2</Position>
<DataType>varchar(30)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="157" parent="21" name="staffId_id">
<Position>3</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="158" parent="21" name="main_staffinfo_bea22849">
<ColNames>staffId_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="159" parent="21">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<foreign-key id="160" parent="21">
<ColNames>staffId_id</ColNames>
<RefTableName>auth_user</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<column id="161" parent="22" name="id">
<Position>1</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="162" parent="22" name="userName">
<Position>2</Position>
<DataType>varchar(25)|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="163" parent="22" name="userSex">
<Position>3</Position>
<DataType>bool|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="164" parent="22" name="userAge">
<Position>4</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="165" parent="22" name="userPhoneNum">
<Position>5</Position>
<DataType>varchar(12)|0s</DataType>
</column>
<column id="166" parent="22" name="userRegistTime">
<Position>6</Position>
<DataType>date|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="167" parent="22" name="userId_id">
<Position>7</Position>
<DataType>integer|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="168" parent="22" name="main_userinfo_3491001b">
<ColNames>userId_id</ColNames>
<ColumnCollations></ColumnCollations>
</index>
<key id="169" parent="22">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<foreign-key id="170" parent="22">
<ColNames>userId_id</ColNames>
<RefTableName>auth_user</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<column id="171" parent="23" name="type">
<Position>1</Position>
<DataType>text|0s</DataType>
</column>
<column id="172" parent="23" name="name">
<Position>2</Position>
<DataType>text|0s</DataType>
</column>
<column id="173" parent="23" name="tbl_name">
<Position>3</Position>
<DataType>text|0s</DataType>
</column>
<column id="174" parent="23" name="rootpage">
<Position>4</Position>
<DataType>int|0s</DataType>
</column>
<column id="175" parent="23" name="sql">
<Position>5</Position>
<DataType>text|0s</DataType>
</column>
<column id="176" parent="24" name="name">
<Position>1</Position>
</column>
<column id="177" parent="24" name="seq">
<Position>2</Position>
</column>
</database-model>
</dataSource>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7" project-jdk-type="Python SDK" />
</project>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Lib.iml" filepath="$PROJECT_DIR$/.idea/Lib.iml" />
</modules>
</component>
</project>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>
-353
View File
@@ -1,353 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="8cda22e5-3b67-4872-87f7-0b9ccf4e6af1" name="Default Changelist" comment="" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="DatabaseView">
<option name="SHOW_INTERMEDIATE" value="true" />
<option name="GROUP_DATA_SOURCES" value="true" />
<option name="GROUP_SCHEMA" value="true" />
<option name="GROUP_CONTENTS" value="false" />
<option name="SORT_POSITIONED" value="false" />
<option name="SHOW_EMPTY_GROUPS" value="false" />
<option name="AUTO_SCROLL_FROM_SOURCE" value="false" />
<option name="HIDDEN_KINDS">
<set />
</option>
<expand>
<path>
<item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
<item name="Django default" type="feb32156:DbDataSourceImpl" />
</path>
<path>
<item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
<item name="Django default" type="feb32156:DbDataSourceImpl" />
<item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
</path>
<path>
<item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
<item name="Django default" type="feb32156:DbDataSourceImpl" />
<item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
<item name="main: schema" type="981a47c2:SqliteImplModel$Schema" />
</path>
</expand>
<select />
</component>
<component name="FileEditorManager">
<leaf>
<file pinned="false" current-in-tab="false">
<entry file="file://E:/anaconda3/Lib/site-packages/django/utils/translation/trans_real.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="149">
<caret line="158" selection-start-line="158" selection-end-line="158" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main/migrations/0001_initial.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="253">
<caret line="54" column="64" selection-start-line="54" selection-start-column="64" selection-end-line="54" selection-end-column="64" />
<folding>
<element signature="e#0#28#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Lib/urls.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="334">
<caret line="22" column="1" selection-start-line="22" selection-start-column="1" selection-end-line="22" selection-end-column="1" />
<folding>
<element signature="e#0#41#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://E:/anaconda3/Lib/site-packages/django/urls/conf.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="201">
<caret line="72" selection-start-line="72" selection-end-line="72" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main/tests.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/Lib/settings.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="608">
<caret line="32" column="1" selection-start-line="32" selection-start-column="1" selection-end-line="32" selection-end-column="1" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main/views.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="228">
<caret line="12" column="39" selection-start-line="12" selection-start-column="39" selection-end-line="12" selection-end-column="39" />
<folding>
<element signature="e#15#26#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main/admin.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="209">
<caret line="11" column="30" selection-start-line="11" selection-start-column="30" selection-end-line="11" selection-end-column="30" />
<folding>
<element signature="e#0#32#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>back</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/main/models.py" />
<option value="$PROJECT_DIR$/Lib/urls.py" />
<option value="$PROJECT_DIR$/Lib/settings.py" />
</list>
</option>
</component>
<component name="ProjectConfigurationFiles">
<option name="files">
<list>
<option value="$PROJECT_DIR$/.idea/Lib.iml" />
<option value="$PROJECT_DIR$/.idea/vcs.xml" />
<option value="$PROJECT_DIR$/.idea/misc.xml" />
<option value="$PROJECT_DIR$/.idea/dataSources.xml" />
<option value="$PROJECT_DIR$/.idea/modules.xml" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-8" />
<option name="width" value="977" />
<option name="height" value="1038" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="Lib" type="b2602c69:ProjectViewProjectNode" />
<item name="Lib" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Lib" type="b2602c69:ProjectViewProjectNode" />
<item name="Lib" type="462c0819:PsiDirectoryNode" />
<item name="Lib" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Lib" type="b2602c69:ProjectViewProjectNode" />
<item name="Lib" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../StudentSystem-master/StudentSystem" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="Lib" type="Python.DjangoServer" factoryName="Django server">
<module name="Lib" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="Lib.settings" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="launchJavascriptDebuger" value="false" />
<option name="port" value="8000" />
<option name="host" value="" />
<option name="additionalOptions" value="" />
<option name="browserUrl" value="" />
<option name="runTestServer" value="false" />
<option name="runNoReload" value="false" />
<option name="useCustomRunCommand" value="false" />
<option name="customRunCommand" value="" />
<method v="2" />
</configuration>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="8cda22e5-3b67-4872-87f7-0b9ccf4e6af1" name="Default Changelist" comment="" />
<created>1594695714059</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1594695714059</updated>
<workItem from="1594695720052" duration="3487000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="3487000" />
</component>
<component name="ToolWindowManager">
<frame x="-7" y="-7" width="1550" height="838" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Favorites" side_tool="true" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
<window_info anchor="bottom" id="Database Changes" />
<window_info anchor="bottom" id="Version Control" />
<window_info anchor="bottom" id="Python Console" />
<window_info anchor="bottom" id="Terminal" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" weight="0.3286119" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="right" id="SciView" />
<window_info anchor="right" id="Database" visible="true" weight="0.3297587" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="editorHistoryManager">
<entry file="file://E:/anaconda3/Lib/site-packages/django/utils/translation/trans_real.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="149">
<caret line="158" selection-start-line="158" selection-end-line="158" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main/migrations/0001_initial.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/main/admin.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="209">
<caret line="11" column="30" selection-start-line="11" selection-start-column="30" selection-end-line="11" selection-end-column="30" />
<folding>
<element signature="e#0#32#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="253">
<caret line="54" column="64" selection-start-line="54" selection-start-column="64" selection-end-line="54" selection-end-column="64" />
<folding>
<element signature="e#0#28#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main/views.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="228">
<caret line="12" column="39" selection-start-line="12" selection-start-column="39" selection-end-line="12" selection-end-column="39" />
<folding>
<element signature="e#15#26#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main/tests.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://E:/anaconda3/Lib/site-packages/django/urls/conf.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="201">
<caret line="72" selection-start-line="72" selection-end-line="72" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Lib/urls.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="334">
<caret line="22" column="1" selection-start-line="22" selection-start-column="1" selection-end-line="22" selection-end-column="1" />
<folding>
<element signature="e#0#41#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Lib/settings.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="608">
<caret line="32" column="1" selection-start-line="32" selection-start-column="1" selection-end-line="32" selection-end-column="1" />
</state>
</provider>
</entry>
</component>
</project>
-116
View File
@@ -1,116 +0,0 @@
"""
Django settings for Lib project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '3^y=5xuy(%igotz@mkpl$xn&7c*nrxt=*am#lpf_(@!iw1c+g%'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
CONTEXT_PROCESSORS = [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {'context_processors': CONTEXT_PROCESSORS, },
},
{
'BACKEND': 'django.template.backends.jinja2.Jinja2'
,
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': CONTEXT_PROCESSORS,
'environment': '存放路径.env.environment'
},
},
]
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
"main",
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'Lib.urls'
WSGI_APPLICATION = 'Lib.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'zh_Hans'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR,"collected_static")
STATICFILES_DIRS = (
os.path.join(BASE_DIR,"common_static"),
'path/to/others/static/',
)
SESSION_SAVE_EVERY_REQUEST = True
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
-23
View File
@@ -1,23 +0,0 @@
from django.conf.urls import include, url
from django.contrib import admin
import main.views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^loginView/',main.views.loginView,name="loginView"),
url(r'^registView/',main.views.registView,name="registView"),
url(r'^logoutView/',main.views.logoutView,name="logoutView"),
url(r'^userBorrowedBook/',main.views.userBorrowedBook,name="userBorrowedBook"),
url(r'^staffAddBookNum/',main.views.staffAddBookNum,name="staffAddBookNum"),
url(r'^staffCreateBook/',main.views.staffCreateBook,name="staffCreateBook"),
url(r'^viewBook/',main.views.viewBook,name="viewBook"),
url(r'^main/',main.views.main,name="main"),
url(r'^regist/',main.views.regist,name="regist"),
url(r'^login/',main.views.login,name="login"),
url(r'^staffBorrowUserBook/',main.views.staffBorrowUserBook,name="staffBorrowUserBook"),
url(r'^staffReturnUserBook/',main.views.staffReturnUserBook,name="staffReturnUserBook"),
url(r'^staffChangeBookInfo/',main.views.staffChangeBookInfo,name="staffChangeBookInfo"),
url(r'^getTypeOptions/',main.views.getTypeOptions,name="getTypeOptions"),
url(r'^staffViewUser/',main.views.staffViewUser,name='staffViewUser'),
url(r'^staffViewUserDetail/',main.views.staffViewUserDetail,name="staffViewUserDetail"),
]
-14
View File
@@ -1,14 +0,0 @@
"""
WSGI config for Lib 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/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Lib.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Binary file not shown.
-12
View File
@@ -1,12 +0,0 @@
from django.contrib import admin
# Register your models here.
from .models import Book,BookType,BookNum,AddItem,BorrowItem,UserInfo,StaffInfo
admin.site.register(Book)
admin.site.register(BookType)
admin.site.register(BookNum)
admin.site.register(AddItem)
admin.site.register(BorrowItem)
admin.site.register(UserInfo)
admin.site.register(StaffInfo)
@@ -1,127 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='AddItem',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('addNum', models.IntegerField()),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Book',
fields=[
('bookId', models.CharField(max_length=40, serialize=False, primary_key=True)),
('bookName', models.CharField(max_length=40)),
('bookPublisher', models.CharField(max_length=40)),
('bookAuthor', models.CharField(max_length=50)),
('bookIntroduction', models.TextField()),
('bookPrice', models.IntegerField()),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='BookNum',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('bookNum', models.IntegerField()),
('bookId', models.ForeignKey(to='main.Book')),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='BookType',
fields=[
('TypeNum', models.IntegerField(serialize=False, primary_key=True)),
('TypeName', models.CharField(max_length=20)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='BorrowItem',
fields=[
('borrowItemId', models.IntegerField(serialize=False, primary_key=True)),
('hasReturned', models.BooleanField(default=False)),
('bookId', models.ForeignKey(to='main.Book')),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='StaffInfo',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('staffName', models.CharField(max_length=30)),
('staffId', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='UserInfo',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('userName', models.CharField(max_length=25)),
('userSex', models.BooleanField(default=True)),
('userAge', models.IntegerField()),
('userPhoneNum', models.CharField(max_length=12, null=True, blank=True)),
('userRegistTime', models.DateField(auto_now_add=True)),
('userId', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
},
bases=(models.Model,),
),
migrations.AddField(
model_name='borrowitem',
name='staffId',
field=models.ForeignKey(to='main.StaffInfo'),
preserve_default=True,
),
migrations.AddField(
model_name='borrowitem',
name='userId',
field=models.ForeignKey(to='main.UserInfo'),
preserve_default=True,
),
migrations.AddField(
model_name='book',
name='bookType',
field=models.ForeignKey(to='main.BookType'),
preserve_default=True,
),
migrations.AddField(
model_name='additem',
name='bookId',
field=models.ForeignKey(to='main.Book'),
preserve_default=True,
),
migrations.AddField(
model_name='additem',
name='staffId',
field=models.ForeignKey(to='main.StaffInfo'),
preserve_default=True,
),
]
-58
View File
@@ -1,58 +0,0 @@
from django.db import models
from django.contrib.auth.models import User as authModel
# Create your models here.
class BookType(models.Model):
TypeNum = models.IntegerField(primary_key=True)
TypeName = models.CharField(max_length=20)
def __unicode__(self):
return '%s' % (self.TypeName)
class Book(models.Model):
bookId = models.CharField(max_length = 40,primary_key= True)
bookName = models.CharField(max_length=40)
bookType = models.ForeignKey(BookType,on_delete=models.CASCADE)
bookPublisher = models.CharField(max_length=40)
bookAuthor = models.CharField(max_length=50)
bookIntroduction = models.TextField()
bookPrice = models.IntegerField()
def __unicode__(self):
return '%s' % (self.bookName)
class BookNum(models.Model):
bookId = models.ForeignKey(Book,on_delete=models.CASCADE)
bookNum = models.IntegerField()
def __unicode__(self):
return '%s' % (self.bookId.bookName)
class StaffInfo(models.Model):
staffId = models.ForeignKey(authModel,on_delete=models.CASCADE)
staffName = models.CharField(max_length = 30)
def __unicode__(self):
return '%s' % (self.staffName)
class AddItem(models.Model):
bookId = models.ForeignKey(Book,on_delete=models.CASCADE)
staffId = models.ForeignKey(StaffInfo,on_delete=models.CASCADE)
addNum = models.IntegerField()
def __unicode__(self):
return '%s' % (self.bookId.bookName)
class UserInfo(models.Model):
userId = models.ForeignKey(authModel,on_delete=models.CASCADE)
userName = models.CharField(max_length=25)
userSex = models.BooleanField(default = True)
userAge = models.IntegerField()
userPhoneNum = models.CharField(max_length=12,null=True,blank=True)
userRegistTime = models.DateField(auto_now_add=True)
def __unicode__(self):
return '%s' % (self.userName)
class BorrowItem(models.Model):
borrowItemId = models.IntegerField(primary_key = True)
bookId = models.ForeignKey(Book,on_delete=models.CASCADE)
staffId = models.ForeignKey(StaffInfo,on_delete=models.CASCADE)
userId = models.ForeignKey(UserInfo,on_delete=models.CASCADE)
hasReturned = models.BooleanField(default = False)
def __unicode__(self):
return '%s' % (self.borrowItemId)
@@ -1,209 +0,0 @@
body{
font-family: 'Microsoft YaHei',sans-serif;
position: relative;
margin:0px;
background-color: #092B40;
}
button{
font-family: 'Microsoft YaHei',sans-serif;
cursor: pointer;
}
.fail{
color:red;
}
.success{
color:green;
}
.hid{
visibility: hidden;
}
.fontBlue{
color:#092B40;
}
.fontOrange{
color:#FF7F00;
}
.fontWhite{
color:#EBEBEB;
}
.backBlue{
background-color:#092B40;
}
.backOrange{
background-color: #FF7F00;
}
.backWhite{
background-color: #EBEBEB;
}
.nav{
width: 100%;
height:50px;
line-height: 50px;
font-size: 19px;
position:fixed;
background-color: rgba(135,135,135,0.5);
margin: 0px;
top:0px;
left:0px;
padding-left: 400px;
z-index: 100;
}
.bookLib{
display: inline-block;
margin:0px;
padding:0px;
height:50px;
padding:0px 10px;
line-height: 50px;
text-decoration: none;
color:white;
}
.bookLib:hover{
background-color: #EEEEE0;
color:#4D4D4D;
}
.container{
width:1200px;
padding:50px;
margin:0px auto;
overflow: hidden;
position: relative;
}
.fullPage{
background-color: #EBEBEB;
width:100%;
height:600px;
margin-bottom: 20px;
overflow: hidden;
}
.two{
width:540px;
margin:10px;
float: left;
overflow: hidden;
height:550px;
padding: 30px 0px 0px 30px;
}
.one{
width:1120px;
margin:10px;
float: left;
overflow: hidden;
height:550px;
padding: 30px 0px 0px 30px;
}
.line{
margin: 10px 0px;
font-size: 20px;
}
.line>span{
display:inline-block;
width: 120px;
}
.line>input{
border: solid 2px #092B40;
padding: 3px 8px;
}
.line>select{
border: solid 2px #092B40;
margin-left: 0px;
padding: 3px 8px;
width:189px;
}
.line>select:focus{
border: solid 2px #092B40;
margin-left: 0px;
padding: 3px 8px;
width:189px;
outline: none
}
.Btn{
outline: none;
background-color: #EBEBEB;
border: solid 2px #092B40;
padding: 5px 8px;
font-size: 18px;
}
.Btn:hover{
background-color: #092B40;
border: solid 2px #FF7F00;
color:#EBEBEB;
}
h1{
margin: 0px;
}
input{
outline: none;
}
.currentUser{
position:fixed;
top:300px;
left:100px;
padding: 20px 20px 10px 20px;
background-color: #EBEBEB;
}
.currentUser>div>a{
width: 50px;
text-align: center;
display:block;
margin:5px auto;
text-decoration:none;
padding:5px 8px;
background-color:#092B40;
color:#EBEBEB;
}
.container{
width:1200px;
padding:50px;
margin:0px auto;
overflow: hidden;
position: relative;
}
.templateUserContainer{
padding:15px 30px;
}
.userItem{
margin-top: 20px;
display: block;
text-decoration: none;
color:black;
padding: 10px 30px;
background-color: rgba(9,43,64,0.3);
}
.userItem:hover{
background-color: #092B40;
color:#EBEBEB;
border-style: none none none solid;
border-width: 5px;
border-color: #FF7F00;
}
.pageList{
margin-top: 30px;
padding-left: 30px;
}
.pageBtn{
outline: none;
border: none;
background-color:#EBEBEB;
text-align: center;
min-width: 15px;
padding: 0px 10px;
margin-right: 2px;
line-height: 30px;
height:30px;
font-size: 15px;
display: inline-block;
color:#092B40;
text-decoration: none;
}
.pageBtn:hover{
color: #EBEBEB;
background-color: #092B40;
border-radius: 3px;
}
.active{
color: #EBEBEB !important;
background-color: #092B40 !important;
border-radius: 3px !important ;
}
@@ -1,169 +0,0 @@
body{
font-family: 'Microsoft YaHei',sans-serif;
position: relative;
margin:0px;
background-color: #092B40;
}
.fail{
color:red;
}
.success{
color:green;
}
.hid{
visibility: hidden;
}
.chosen{
visibility: visible !important;
}
.nav{
width: 100%;
height:50px;
line-height: 50px;
font-size: 19px;
position:fixed;
background-color: rgba(135,135,135,0.5);
margin: 0px;
top:0px;
left:0px;
padding-left: 400px;
z-index: 100;
}
.currentUser{
position:fixed;
top:300px;
left:100px;
padding: 20px 20px 10px 20px;
background-color: #EBEBEB;
}
.currentUser>div>a{
width: 50px;
text-align: center;
display:block;
margin:5px auto;
text-decoration:none;
padding:5px 8px;
background-color:#092B40;
color:#EBEBEB;
}
.container{
width:1200px;
padding:50px;
margin:0px auto;
overflow: hidden;
position: relative;
}
.bookLib{
display: inline-block;
margin:0px;
padding:0px;
height:50px;
padding:0px 10px;
line-height: 50px;
text-decoration: none;
color:white;
}
.bookLib:hover{
background-color: #EEEEE0;
color:#4D4D4D;
}
.searchArea{
margin-top: 30px;
float:right;
}
.searchArea>button{
border:solid 4px #FF7F00;
border-radius: 5px;
background-color: #6495ED;
color:white;
padding:5px 10px;
font-size: 1.3em;
color: white;
background-color: #092B40;
cursor: pointer;
}
.searchArea>input{
border:solid 3px #FF7F00;
border-radius: 10px;
height:33px;
padding: 2px 10px;
line-height: 33px;
font-size: 1.3em;
margin-right: 5px;
outline: none;
color: white;
background-color: #092B40;
}
.bookList{
clear: both;
position: relative;
top:20px;
width: 1010px;
margin:0px auto;
z-index: 10;
}
.bookName{
font-size: 20px;
}
.bookType,.bookPublisher,.bookAuthor,.bookPrice,.bookNum{
font-size: 17px;
}
.intro{
font-size: 15px;
color:gray;
}
.book{
width:1010px;
height:120px;
margin-bottom: 10px;
cursor: pointer;
}
.hover{
background-color: #FF7F00;
width:10px;
float:left;
height:120px;
}
.bookMain{
float: left;
width:980px;
padding-left:20px;
background-color: #EBEBEB;
}
.bookDetail{
width:800px;
background-color:#D9D9D9;
margin:-10px auto 0px auto;
}
.pageListBox{
left:10px;
top: 20px;
position: relative;
width: 1010px;
margin:10px auto;
color:#EBEBEB;
}
.pageBtn{
text-align: center;
min-width: 15px;
padding: 0px 10px;
margin-right: 2px;
line-height: 30px;
height:30px;
font-size: 15px;
display: inline-block;
border: solid 2px #EBEBEB;
border-radius: 5px;
color:#EBEBEB;
text-decoration: none;
}
.pageBtn:hover{
color: #092B40;
background-color: #EBEBEB;
border: solid 2px #FF7F00;
}
.active{
color: #092B40 !important ;
background-color: #EBEBEB !important ;
border: solid 2px #FF7F00 !important ;
}
@@ -1,54 +0,0 @@
body{
font-family: 'Microsoft YaHei',sans-serif;
}
.fail{
color:red;
}
.success{
color:green;
}
.container{
width:400px;
margin:300px auto;
}
.inputArea{
color:#aaa;
width:388px;
display: inline-block;
border:solid 1px #ddd;
border-radius: 2px;
font-size: 14px;
outline: none;
padding: 10px 0px 10px 10px;
margin:15px 0px 15px 0px;
}
.btn{
height: 38px;
width:184px;
outline: none;
margin-top: 10px;
float:left;
font-size: 14px;
display: inline-block;
text-align: center;
text-decoration: none;
line-height:38px;
}
.loginBtn{
border: 1px solid #0381AA;
background-color: #00A7DE;
color:white;
cursor:pointer;
}
.loginBtn:hover{
background-color: #00a1d6;\
}
.registBtn{
margin-left: 28px;
color: #555;
border: 1px solid #ccc;
}
.registBtn:hover{
background-color: gray;
color:white;
}
@@ -1,14 +0,0 @@
body{
font-family: 'Microsoft YaHei',sans-serif;
position: relative;
margin:0px;
background-color: #092B40;
}
.container{
width:1200px;
padding:50px;
margin:400px auto;
overflow: hidden;
color:#EBEBEB;
text-align: center;
}
@@ -1,54 +0,0 @@
body{
font-family: 'Microsoft YaHei',sans-serif;
}
.fail{
color:red;
}
.success{
color:green;
}
.container{
width:400px;
margin:100px auto;
}
.inputArea{
color:#aaa;
width:388px;
display: inline-block;
border:solid 1px #ddd;
border-radius: 2px;
font-size: 14px;
outline: none;
padding: 10px 0px 10px 10px;
margin:15px 0px 15px 0px;
}
.btn{
height: 38px;
width:184px;
outline: none;
margin-top: 10px;
float:left;
font-size: 14px;
display: inline-block;
text-align: center;
text-decoration: none;
line-height:38px;
}
.registBtn{
border: 1px solid #0381AA;
background-color: #00A7DE;
color:white;
cursor:pointer;
}
.registBtn:hover{
background-color: #00a1d6;\
}
.backBtn{
margin-left: 28px;
color: #555;
border: 1px solid #ccc;
}
.backBtn:hover{
background-color: gray;
color:white;
}
@@ -1,107 +0,0 @@
body{
font-family: 'Microsoft YaHei',sans-serif;
position: relative;
margin:0px;
background-color: #092B40;
}
button{
font-family: 'Microsoft YaHei',sans-serif;
cursor: pointer;
}
.fail{
color:red;
}
.success{
color:green;
}
.hid{
visibility: hidden;
}
.fontBlue{
color:#092B40;
}
.fontOrange{
color:#FF7F00;
}
.fontWhite{
color:#EBEBEB;
}
.backBlue{
background-color:#092B40;
}
.backOrange{
background-color: #FF7F00;
}
.backWhite{
background-color: #EBEBEB;
}
.nav{
width: 100%;
height:50px;
line-height: 50px;
font-size: 19px;
position:fixed;
background-color: rgba(135,135,135,0.5);
margin: 0px;
top:0px;
left:0px;
padding-left: 400px;
z-index: 100;
}
.bookLib{
display: inline-block;
margin:0px;
padding:0px;
height:50px;
padding:0px 10px;
line-height: 50px;
text-decoration: none;
color:white;
}
.bookLib:hover{
background-color: #EEEEE0;
color:#4D4D4D;
}
.currentUser{
position:fixed;
top:300px;
left:100px;
padding: 20px 20px 10px 20px;
background-color: #EBEBEB;
}
.currentUser>div>a{
width: 50px;
text-align: center;
display:block;
margin:5px auto;
text-decoration:none;
padding:5px 8px;
background-color:#092B40;
color:#EBEBEB;
}
.container{
width:1200px;
padding:50px;
margin:0px auto;
overflow: hidden;
position: relative;
}
.userInfoContainer{
padding: 50px;
}
.infoItem{
height:30px;
line-height: 30px;
display: block;
}
.infoBefore{
text-align: center;
display: inline-block;
width: 90px;
}
.borrowTable{
width: 1000px;
}
.borrowTable td{
text-align: center;
}
@@ -1,36 +0,0 @@
jQuery(document).ajaxSend(function(event, xhr, settings) {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
function sameOrigin(url) {
// url could be relative or scheme relative or absolute
var host = document.location.host; // host + port
var protocol = document.location.protocol;
var sr_origin = '//' + host;
var origin = protocol + sr_origin;
// Allow absolute or scheme relative URLs to same origin
return (url == origin || url.slice(0, origin.length + 1) == origin + '/') ||
(url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') ||
// or any other URL that isn't scheme relative or absolute i.e relative.
!(/^(\/\/|http:|https:).*/.test(url));
}
function safeMethod(method) {
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}
});
@@ -1,182 +0,0 @@
function initUserScan(userName,Page){
$('#startPage').val(Page);
var userHtml = '',pageHtml = '';
var username = userName;
var offset = $('#offset').val(),startPage = Page;
$.get('/staffViewUser',
{'username':username,
'offset':offset,
'startPage':startPage},
function(data) {
//console.log(data);
for(var i=0;i<data.userList.length;i++){
userItem = data.userList[i];
//console.log(userItem.userid);
userHtml += '<a href="/staffViewUserDetail/?userid='+userItem.userid+'" class="userItem">'+
'<div><span>'+userItem.userid+'</span>&nbsp;&nbsp;&nbsp;<span>'+userItem.username+'</span></div>'
+'<div><span>'+userItem.userage+'</span></div>'
+'</a>';
}
$('.templateUserContainer').html(userHtml);
if(startPage!=1){pageHtml = '<button class="prev pageBtn"><<</button>';}
for(var i=0;i<data.pageList.length;i++){
pageItem = data.pageList[i];
//console.log(pageItem);
if(pageItem == data.currentPage) pageHtml += '<button class="active pageBtn">'+pageItem+'</button>';
else pageHtml += '<button class="pageBtn">'+pageItem+'</button>';
}
if(startPage != data.pageList[data.pageList.length-1]) pageHtml += '<button class="next pageBtn">>></button>';
$('.pageList').html(pageHtml);
$('.pageBtn').click(function(event) {
//var targetPage = $(this).text();
//startPage = $('#startPage').val(targetPage);
if($(this).hasClass('next')){
targetPage = parseInt($('#startPage').val())+1;
}
else if($(this).hasClass('prev')){
targetPage = parseInt($('#startPage').val())-1;
}
else{
targetPage = $(this).text();
}
initUserScan($('#changeUserName').val(),targetPage);
});
});
}
initUserScan('',1);
$(document).ready(function(){
var typeOptions = [];
$.get('/getTypeOptions', function(data) {
typeOptions = data;
//console.log(typeOptions);
});
$('.changeUserBtnCheck').click(function(event) {
initUserScan($('#changeUserName').val(),1);
});
$('.returnBtnCheck').click(function(event) {
var bookid=$('#returnBookid').val();
var userid=$('#returnUserid').val();
$.get('/staffReturnUserBook',{"bookid":bookid,"userid":userid},function(data) {
$('.returnBookMsg').removeClass('success').removeClass('fail').text("");
bookid=$('#returnBookid').val("");
userid=$('#returnUserid').val("");
if(data.end){
$('.returnBookMsg').addClass('success').text("还书成功!");
}
else{
$('.returnBookMsg').addClass('fail').text("还书失败!请重新操作");
}
});
});
$('.borrowBtnCheck').click(function(event) {
var bookid=$('#borrowBookid').val();
var userid=$('#borrowUserid').val();
console.log(bookid+userid);
$.get('/staffBorrowUserBook',{"bookid":bookid,"userid":userid},function(data) {
$('.borrowBookMsg').removeClass('success').removeClass('fail').text("");
$('#borrowBookid').val("");
$('#borrowUserid').val("");
if(data.end){
$('.borrowBookMsg').addClass('success').text("借书成功!");
}
else{
$('.borrowBookMsg').addClass('fail').text("借书失败!请重新操作");
}
});
});
$('.createBtnCheck').click(function(event){
var bookid = $('#createBookId').val();
var bookname = $('#createBookName').val();
var booktype = $('#createBookType').val();
var bookpub = $('#createBookPub').val();
var bookauthor = $('#createBookAuthor').val();
var bookintro = $('#createBookIntro').val();
var bookprice = $('#createBookPrice').val();
var booknum = $('#createBookNum').val();
$.get('/staffCreateBook',
{"bookid":bookid,
"bookname":bookname,
"booktype":booktype,
"bookpublisher":bookpub,
"bookauthor":bookauthor,
"bookintroduction":bookintro,
"bookprice":bookprice,
"booknum":booknum},function(data) {
console.log(data);
});
});
$('.addBtnCheck').click(function(event) {
var bookid = $('#addBookId').val();
var addnum = $('#addBookNum').val();
$.get('/staffAddBookNum',{"bookid":bookid,"addBookNum":addnum},function(data) {
console.log(data);
});
});
$('.changeBookBtnCheck').click(function(event) {
var template ='';
var bookid = $('#changeBookId').val();
$.get('/viewBook',{"mode":"Detail","startPage":0,"offset":10,"bookLikeName":bookid},function(data) {
optionTemplate = '';
for(var i=0;i<typeOptions.length;i++){
option = typeOptions[i];
console.log(option);
if(option.optionName == data.bookType){
optionTemplate+='<option value="'+option.num+'" selected="true">'+option.optionName+'</option>'
}
else optionTemplate+='<option value="'+option.num+'">'+option.optionName+'</option>'
}
console.log(data);
template+= '<input class="changeBookId" value="'+data.bookId+'" type="hidden"/>'+
'<div class="line">'+
'<span>图书名称:</span><input type="text" class="changeBookName" value="'+data.bookName+'"/>'+
'</div>'+
'<div class="line">'+
'<span>图书类型:</span>'+
'<select class="changeBookType">'+
optionTemplate+
'</select>'+
'</div>'+
'<div class="line">'+
'<span>作者:</span><input type="text" class="changeBookAuthor" value="'+data.bookAuthor+'"/>'+
'</div>'+
'<div class="line">'+
'<span>出版社:</span><input type="text" class="changeBookPublisher" value="'+data.bookPublisher+'"/>'+
'</div>'+
'<div class="line">'+
'<span>简介:</span><input type="text" class="changeBookIntro" value="'+data.bookIntroduction+'"/>'+
'</div>'+
'<div class="line">'+
'<span>价格:</span><input type="text" class="changeBookPrice" value="'+data.bookPrice+'"/>'+
'</div>'+
'<div class="line">'+
'<span>库存:</span><input type="text" class="changeBookNum" value="'+data.bookNum+'"/>'+
'</div>';
$('.templateBookContainer').html(template);
$('.changeBookBtnSubmit').removeClass('hid');
});
});
$('.changeBookBtnSubmit').click(function(event) {
var bookid = $('.changeBookId').val();
var bookname = $('.changeBookName').val();
var booktype = $('.changeBookType').val();
var bookauthor = $('.changeBookAuthor').val();
var bookpublisher = $('.changeBookPublisher').val();
var bookintro = $('.changeBookIntro').val();
var bookprice = $('.changeBookPrice').val();
var booknum = $('.changeBookNum').val();
$.get('/staffChangeBookInfo',
{"bookid":bookid,
"bookname":bookname,
"booktype":booktype,
"bookauthor":bookauthor,
"bookpublisher":bookpublisher,
"bookintroduction":bookintro,
"bookprice":bookprice,
"booknum":booknum},
function(data) {
console.log(data);
});
});
});
File diff suppressed because it is too large Load Diff
@@ -1,20 +0,0 @@
$('.book').hover(function() {
/* Stuff to do when the mouse enters the element */
$(this).find(".hover").removeClass('hid');
}, function() {
/* Stuff to do when the mouse leaves the element */
$(this).find(".hover").addClass('hid');
});
$(".bookMain").click(function(event) {
var textDom = $(this).parent().next();
var hoverDom = $(this).parent().find(".hover");
hoverDom.addClass('chosen');
$(this).parent().siblings().find(".hover").removeClass('chosen').parent().next().html("");
bookid = $(this).find(".id").val();
$.get('/viewBook/',{"bookLikeName":bookid,"mode":"Detail","startPage":1,"offset":10},function(data) {
html = '<div class="bookDetail"><span>编号:</span><span class="bookDetailId">'+data.bookId+'</span><br /><span>书名:</span><span class="bookDetailName">'+data.bookName+'</span><br /><span>类型:</span><span class="bookDetailType">'+data.bookType+'</span><br /><span>作者:</span><span class="bookDetailAuthor">'+data.bookAuthor+'</span><br /><span>出版社:</span><span class="bookDetailPublisher">'+data.bookPublisher+'</span><br /><span>简介:</span><span class="bookDetailIntro">'+data.bookIntroduction+'</span><br /><span>价格:</span><span class="bookDetailPrice">'+data.bookPrice+'$</span><br /><span>库存:</span><span class="bookDetailNum">'+data.bookNum+'</span><br />'
if(data.bookNum == "0") html += '<span>状态:</span><span class="bookDetailCanBorrow fail">不可借阅</span><br /></div>';
else html += '<span>状态:</span><span class="bookDetailCanBorrow success">可借阅</span><br /></div>';
textDom.html(html);
});
});
@@ -1,139 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="keywords" content=""/>
<meta name="author" content="ZhangWeiJian"/>
<title>管理员操作中心</title>
<link rel="stylesheet" type="text/css" href="../static/css/indexStaff.css" />
<script type="text/javascript" src="../static/scripts/jquery.js"></script>
</head>
<body>
<div class="nav">
{% if is_staff %}
<a href="/main" class="bookLib">管理员中心</a>
{% else %}
<a href="/main" class="bookLib">用户中心</a>
{% endif %}
<a href="/viewBook/?bookLikeName=&mode=simple&startPage=1&offset=10" class="bookLib">图书库</a>
</div>
<div class="currentUser">
<div>
<span class="staffId"><strong>{{currentUser.userId}}</strong></span>
{% if is_staff %}
管理员&nbsp;&nbsp;&nbsp;
{% else %}
用户&nbsp;&nbsp;&nbsp;
{% endif %}
<br/>
<span class="staffName"><strong>{{currentUser.userName}}</strong></span><br/>
<a href="/logoutView" class="logout">登出</a>
</div>
</div>
<div class="moduleLink">
</div>
<div class="container">
<div class="fullPage">
<div class="borrow two fontBlue">
<h1><strong></strong></h1>
<div class="line">
<span>bookId :</span><input type="text" id="borrowBookid"/>
</div>
<div class="line">
<span>userId :</span><input type="text" id="borrowUserid"/>
</div>
<button class="borrowBtnCheck Btn">借阅</button>
<div class="line"><p class="borrowBookMsg"></p></div>
</div>
<div class="return two fontBlue">
<h1><strong></strong></h1>
<div class="line">
<span>bookId :</span><input id="returnBookid" type="text" />
</div>
<div class="line">
<span>userId :</span><input id="returnUserid" type="text" />
</div>
<button class="returnBtnCheck Btn">还书</button>
<div class="line"><p class="returnBookMsg"></p></div>
</div>
</div>
<div class="fullPage">
<div class="add two fontBlue">
<h1><strong>添加图书数量</strong></h1>
<div class="line">
<span>图书编号 :</span><input type="text" id="addBookId" />
</div>
<div class="line">
<span>数量 :</span><input type="text" id="addBookNum" />
</div>
<button class="addBtnCheck Btn">添加</button>
</div>
<div class="create two fontBlue">
<h1><strong>添加图书类别</strong></h1>
<div class="line">
<span>图书编号 :</span><input type="text" id="createBookId" />
</div>
<div class="line">
<span>书名 :</span><input type="text" id="createBookName" />
</div>
<div class="line">
<span>类型 :</span>
<select id="createBookType">
{% for typeItem in typeList %}
<option value="{{typeItem.typeNum}}">{{typeItem.typeInfo}}</option>
{% endfor %}
</select>
</div>
<div class="line">
<span>出版社 :</span><input type="text" id="createBookPub" />
</div>
<div class="line">
<span>作者 :</span><input type="text" id="createBookAuthor" />
</div>
<div class="line">
<span>简介 :</span><input type="text" id="createBookIntro" />
</div>
<div class="line">
<span>价格 :</span><input type="text" id="createBookPrice" />
</div>
<div class="line">
<span>数量 :</span><input type="text" id="createBookNum" />
</div>
<button class="createBtnCheck Btn">添加</button>
</div>
</div>
<div class="fullPage">
<div class="changeBook one fontBlue">
<div class="line">
<div class="line" style="float:right;">
<input type="text" id="changeBookId" />
<button class="changeBookBtnCheck Btn">Check</button>
</div>
<h1><strong>更改图书信息</strong></h1>
</div>
<div class="templateBookContainer"></div>
<button class="changeBookBtnSubmit Btn hid">Change</button>
</div>
</div>
<div class="fullPage">
<div class="viewUser one fontBlue">
<div class="line">
<div class="line" style="float:right;">
<input type="text" id="changeUserName" />
<input type="hidden" id="offset" value="3"/>
<input type="hidden" id="startPage" value="1"/>
<button class="changeUserBtnCheck Btn">Check</button>
</div>
<h1><strong>浏览用户信息</strong></h1>
</div>
<div class="templateUserContainer">
</div>
<div class="pageList">
</div>
</div>
</div>
</div>
<script type="text/javascript" src="../static/scripts/indexStaff.js"></script>
</body>
</html>
@@ -1,88 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="keywords" content=""/>
<meta name="author" content="ZhangWeiJian"/>
<link rel="stylesheet" type="text/css" href="../static/css/library.css" />
<script type="text/javascript" src="../static/scripts/jquery.js"></script>
<title>图书列表</title>
</head>
<body>
<div class="nav">
{% if is_staff %}
<a href="/main" class="bookLib">管理员中心</a>
{% else %}
<a href="/main" class="bookLib">用户中心</a>
{% endif %}
<a href="/viewBook/?bookLikeName=&mode=simple&startPage=1&offset=10" class="bookLib">图书库</a>
</div>
<div class="currentUser">
<div>
<span class="staffId"><strong>{{currentUser.userId}}</strong></span>
{% if is_staff %}
管理员&nbsp;&nbsp;&nbsp;
{% else %}
用户&nbsp;&nbsp;&nbsp;
{% endif %}
<br/>
<span class="staffName"><strong>{{currentUser.userName}}</strong></span><br/>
<a href="/logoutView" class="logout">登出</a>
</div>
</div>
<div class="container">
<form class="searchArea" action="/viewBook/" method="get">
<input class="inputArea" name="bookLikeName" type="text"/>
<input name="mode" value="simple" type="hidden"/>
<input name="startPage" value="1" type="hidden"/>
<input name="offset" value="10" type="hidden"/>
<button class="searchBtn">Search...</button>
</form>
<div class="bookList">
{% for book in bookList %}
<div class="book">
<div class="hover hid"></div>
<div class="bookMain">
<div>
<input class="id" value={{book.bookId}} type="hidden"/>
<span class="bookName"><strong>{{book.bookName}}</strong></span>&nbsp;&nbsp;&nbsp;
<span class="bookType">{{book.bookType}}</span>
</div>
<div>
<span class="bookPublisher">{{book.bookPublisher}}</span>&nbsp;&nbsp;&nbsp;
<span class="bookAuthor">{{book.bookAuthor}}</span>
</div>
<div>
<span class="bookPrice fail">{{book.bookPrice}}$</span>&nbsp;&nbsp;&nbsp;
{% if book.bookNum %}
库存:<span class="bookNum success">{{book.bookNum}}</span>
{% else %}
库存:<span class="bookNum fail"><strong>0</strong></span>
{% endif %}
</div>
<p class="intro">{{book.bookIntroduction}}</p>
</div>
</div>
<div></div>
{% endfor %}
</div>
<div class="pageListBox">
{% if currentPage != 1 %}
<a href="/viewBook/?bookLikeName={{bookLikeName}}&mode=simple&startPage={{prevPage}}&offset=10" class="prev pageBtn">上一页</a>
{% endif %}
{% for i in pageList %}
{% if i == currentPage %}
<a href="/viewBook/?bookLikeName={{bookLikeName}}&mode=simple&startPage={{i}}&offset=10" class="pageBtn active">{{i}}</a>
{% else %}
<a href="/viewBook/?bookLikeName={{bookLikeName}}&mode=simple&startPage={{i}}&offset=10" class="pageBtn">{{i}}</a>
{% endif %}
{% endfor %}
{% if currentPage != endPage %}
<a href="/viewBook/?bookLikeName={{bookLikeName}}&mode=simple&startPage={{nextPage}}&offset=10" class="next pageBtn">下一页</a>{{page_range}}
{% endif %}
</div>
</div>
<script type="text/javascript" src="../static/scripts/library.js"></script>
</body>
</html>
@@ -1,32 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="keywords" content=""/>
<meta name="author" content="ZhangWeiJian"/>
<link rel="stylesheet" type="text/css" href="../static/css/login.css" />
<title>登陆</title>
</head>
<body>
<div>
<div class="container">
<div class="login">
<form action="/login/" method="post">
{% csrf_token %}
<input type="text" name="id" id="id" class="inputArea" placeholder="你的用户ID">
<input type="password" name="pw" id="pw" class="inputArea" placeholder="密码">
<input id="submit" class="loginBtn btn" type="submit" value="登陆" />
<a id="registBtn" class="registBtn btn" href="/registView" >注册</a>
<p class="fail">{{msgFail}}</p>
<p class="success">{{msgTrue}}</p>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="../static/scripts/jquery.js"></script>
<script type="text/javascript" src="../static/scripts/csrf.js"></script>
<!--script type="text/javascript" src="../static/scripts/login.js"></script-->
</body>
</html>
@@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="keywords" content=""/>
<meta name="author" content="ZhangWeiJian"/>
<meta http-equiv="refresh" content="3;url=/loginView/"/>
<link rel="stylesheet" type="text/css" href="../static/css/logout.css" />
<script type="text/javascript" src="../static/scripts/jquery.js"></script>
<title>您已退出登陆</title>
</head>
<body>
<div class="container">
<h2>您已退出登陆</h2><h4>3S后自动跳转</h4>
</div>
</body>
</html>
@@ -1,37 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="keywords" content=""/>
<meta name="author" content="ZhangWeiJian"/>
<link rel="stylesheet" type="text/css" href="../static/css/regist.css" />
<title>注册</title>
</head>
<body>
<div class="container">
<div class="regist">
<form action="/regist/" method="post">
{% csrf_token %}
<input type="text" name="id" id="id" class="inputArea" placeholder="用户ID" />
<input type="password" name="pw" id="pw" class="inputArea" placeholder="密码" />
<input type="text" name="name" id="name" class="inputArea" placeholder="用户名" />
<select id="sex" name="sex" class="inputArea">
<option value="True"></option>
<option value=""></option>
</select>
<input type="text" name="age" id="age" class="inputArea" placeholder="年龄" />
<input type="text" name="email" id="email" class="inputArea" placeholder="E-Mail" />
<input type="text" name="phonenum" id="phonenum" class="inputArea" placeholder="手机号" />
<button id="submit" class="registBtn btn" type="submit" >注册</button>
<a id="backBtn" class="backBtn btn" href="/loginView" >返回</a>
<p class="fail">{{msgFail}}</p>
<p class="success">{{msgTrue}}</p>
</form>
</div>
</div>
<script type="text/javascript" src="../static/scripts/jquery.js"></script>
<script type="text/javascript" src="../static/scripts/csrf.js"></script>
</body>
</html>
@@ -1,72 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="keywords" content=""/>
<meta name="author" content="ZhangWeiJian"/>
<link rel="stylesheet" type="text/css" href="../static/css/userDetail.css" />
<script type="text/javascript" src="../static/scripts/jquery.js"></script>
<title>用户信息界面</title>
</head>
<body>
<div class="nav">
{% if is_staff %}
<a href="/main" class="bookLib">管理员中心</a>
{% else %}
<a href="/main" class="bookLib">用户中心</a>
{% endif %}
<a href="/viewBook/?bookLikeName=&mode=simple&startPage=1&offset=10" class="bookLib">图书库</a>
</div>
<div class="currentUser">
<div>
<span class="staffId"><strong>{{currentUser.userId}}</strong></span>
{% if is_staff %}
管理员&nbsp;&nbsp;&nbsp;
{% else %}
用户&nbsp;&nbsp;&nbsp;
{% endif %}
<br/>
<span class="staffName"><strong>{{currentUser.userName}}</strong></span><br/>
<a href="/logoutView" class="logout">登出</a>
</div>
</div>
<div class="container">
<div class="userInfoContainer backWhite fontBlue">
<p class="infoItem"><span class="infoBefore">用户ID</span>:<span>{{userInfo.userid}}</span></p>
<p class="infoItem"><span class="infoBefore">用户名</span>:<span>{{userInfo.username}}</span></p>
<p class="infoItem"><span class="infoBefore">性别</span>:<span>{{userInfo.sex}}</span></p>
<p class="infoItem"><span class="infoBefore">年龄</span>:<span>{{userInfo.age}}</span></p>
<p class="infoItem"><span class="infoBefore">E-mail</span>:<span>{{userInfo.email}}</span></p>
<p class="infoItem"><span class="infoBefore">联系电话</span>:<span>{{userInfo.pn}}</span></p>
<p class="infoItem"><span class="infoBefore">注册时间</span>:<span>{{userInfo.time}}</span></p>
<hr />
<div class="borrowInfoList">
<table class="borrowTable" cellpadding="10">
<tbody>
<tr>
<th></th>
<th>书名</th>
<th>操作员ID</th>
<th>是否已还</th>
</tr>
{% for borrowItem in borrowList %}
<tr>
<td>{{borrowItem.itemNum}}</td>
<td>{{borrowItem.bookName}}</td>
<td>{{borrowItem.staffId}}</td>
{% if borrowItem.hasReturn %}
<td class="success"><strong>&#10004</strong></td>
{% else %}
<td class="fail"><strong>&#10008</strong></td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
<hr />
</div>
</div>
<script type="text/javascript" src="../static/scripts/userDetail.js"></script>
</body>
</html>
-3
View File
@@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.
-451
View File
@@ -1,451 +0,0 @@
# coding:utf-8
import json
from django.shortcuts import render
from django.http import HttpResponse,HttpResponseRedirect
from django.contrib.auth.models import Permission
from django.contrib.auth.models import User as authUser
from django.contrib import auth
from django.core.paginator import Paginator
from main.models import Book,BookType,BookNum,AddItem,BorrowItem,UserInfo,StaffInfo
# Create your views here.
def loginView(request):
if request.user.is_authenticated():
auth.logout(request)
return render(request,"login.html",{'msgFail':'已有用户登陆中,自动登出请重新登陆'})
else:
return render(request,"login.html")
def logoutView(request):
auth.logout(request)
return render(request,"logout.html")
def registView(request):
return render(request,"regist.html")
def main(request):
if request.user.is_authenticated():
currentUser = request.user
if currentUser.is_staff:
staffInfo = StaffInfo.objects.get(staffId=currentUser)
typeInfo = []
for typeItem in BookType.objects.all():
typeInfo.append({"typeNum":typeItem.TypeNum,"typeInfo":typeItem.TypeName})
currentUserInfo = {"userId":currentUser.username,
"userName":staffInfo.staffName}
return render(request,'indexStaff.html',{"currentUser":currentUserInfo,"is_staff":True,"typeList":typeInfo})#To staffMain
else:
return HttpResponseRedirect("/staffViewUserDetail")
else:
return HttpResponseRedirect("/loginView")
def logout(request):
if request.user.is_authenticated():
auth.logout(request)
return HttpResponseRedirect("/login")
else:
return HttpResponseRedirect("/login")
def regist(request):
try:
userid = request.POST['id']
userpw = request.POST['pw']
useremail = request.POST['email']
username = request.POST['name']
usersex = request.POST['sex']
userage = request.POST['age']
userpn = request.POST['phonenum']
except:
HttpResponseRedirect("/registView")
try:
user = authUser.objects.create_user(username = userid,
password = userpw,
email = useremail)
user.is_staff = False
user.save()
try:
UserInfo.objects.create(userId = user,
userName = username,
userSex = usersex,
userAge = userage,
userPhoneNum = userpn)
except:
return HttpResponse("regist fail")
return HttpResponseRedirect("/loginView")
except:
return HttpResponseRedirect("/registView")
def login(request):
try:
userId = request.POST['id']
userPw = request.POST['pw']
except:
return HttpResponseRedirect("/login")
user = auth.authenticate(username=userId,password=userPw)
if user is not None and user.is_active:
auth.login(request,user)
return HttpResponseRedirect("/main")
else:
return HttpResponseRedirect("/login")
def userBorrowedBook(request):#得到当前用户已借阅图书数组
if request.user.is_authenticated():
currentUser = request.user
if currentUser.is_staff:
try:
userid = request.GET['userid']
userInfoFK = UserInfo.objects.get(userId = authUser.objects.get(username=userid))
borrowItems = BorrowItem.objects.filter(userId = userInfoFK)
ansBookList = []
for item in borrowItems:
if not item.hasReturned:
ansBookList.append(item.bookId)
ans = []
for bookItem in ansBookList:
currentBook = {"name":bookItem.bookName,
"type":bookItem.bookType.TypeName,
"author":bookItem.bookAuthor,
"price":bookItem.bookPrice}
ans.append(currentBook)
return HttpResponse(json.dumps({"end":True,"msg":ans}),content_type="application/json")
except:
return HttpResponse(json.dumps({"end":False}),content_type="application/json")
else:
try:
userInfoFK = UserInfo.objects.get(userId=currentUser)
borrowItems = BorrowItem.objects.filter(userId = userInfoFK)
ansBookList = []
for item in borrowItems:
if not item.hasReturned:
ansBookList.append(item.bookId)
ans = []
for bookItem in ansBookList:
currentBook = {"name":bookItem.bookName,
"type":bookItem.bookType.TypeName,
"author":bookItem.bookAuthor,
"price":bookItem.bookPrice}
ans.append(currentBook)
return HttpResponse(json.dumps({"end":True,"msg":ans}),content_type="application/json")
except:
return HttpResponse(json.dumps({"end":False}),content_type="application/json")
return HttpResponse(json.dumps({"end":False}),content_type="application/json")
else:
return HttpResponse(json.dumps({"end":False}),content_type="application/json")
def viewBook(request):
if request.user.is_authenticated():
currentUser = request.user
if currentUser.is_staff:
staffOrNot = True
userFK = StaffInfo.objects.get(staffId=currentUser).staffName
else:
staffOrNot = False
userFK = UserInfo.objects.get(userId=currentUser).userName
currentUserTrans = {"userId":currentUser.username,"userName":userFK}
try:
mode = request.GET['mode']
startPage = request.GET['startPage']
offset = request.GET['offset']
bookLikeName = request.GET['bookLikeName']
except:
return HttpResponse("get error")
ans = []
if mode == 'Detail':
BookAns = Book.objects.get(bookId=bookLikeName)#得到书的详细信息
BookNumFK = BookNum.objects.get(bookId=BookAns)
BookDetail = {"bookId":BookAns.bookId,
"bookName":BookAns.bookName,
"bookType":BookAns.bookType.TypeName,
"bookPublisher":BookAns.bookPublisher,
"bookAuthor":BookAns.bookAuthor,
"bookIntroduction":BookAns.bookIntroduction,
"bookPrice":BookAns.bookPrice,
"bookNum":BookNumFK.bookNum}
return HttpResponse(json.dumps(BookDetail),content_type="application/json")
elif mode == "simple":
currentPage = int(startPage)
if bookLikeName == '':#一连串书的信息
BookAll = Book.objects.all().order_by("bookName")
else:
BookAll = Book.objects.filter(bookName__contains=bookLikeName).order_by("bookName")
bookPagi = Paginator(BookAll,int(offset))
pageN = bookPagi.page(currentPage)
pageNum = bookPagi.page_range[-1]
after_range_num = 5
befor_range_num = 4
bookAnsList = pageN.object_list
if currentPage-1>after_range_num:
pageList = bookPagi.page_range[currentPage-1-after_range_num:currentPage-1+befor_range_num]
else:
pageList = bookPagi.page_range[0:currentPage-1+befor_range_num]
for BookAns in bookAnsList:
BookNumFK = BookNum.objects.get(bookId=BookAns)
BookDetail = {"bookName":BookAns.bookName,
"bookId":BookAns.bookId,
"bookType":BookAns.bookType.TypeName,
"bookPublisher":BookAns.bookPublisher,
"bookAuthor":BookAns.bookAuthor,
"bookPrice":BookAns.bookPrice,
"bookNum":BookNumFK.bookNum,
"bookIntroduction":BookAns.bookIntroduction[:60]}
ans.append(BookDetail)
return render(request,'library.html',{"currentUser":currentUserTrans,"is_staff":staffOrNot,"bookList":ans,"bookLikeName":bookLikeName,"pageList":pageList,"currentPage":currentPage,"nextPage":currentPage+1,"prevPage":currentPage-1,"endPage":pageNum})
else:
return HttpResponseRedirect("/login")
def staffCreateBook(request):#添加Book信息,添加BookNum=0
if request.user.is_authenticated():
currentUser = request.user
if currentUser.is_staff:
if currentUser.has_perms(["main.add_additem","main.add_booknum"]):
try:
bookid = request.GET['bookid']
bookname = request.GET['bookname']
booktype = request.GET['booktype']
bookpublisher = request.GET['bookpublisher']
bookauthor = request.GET['bookauthor']
bookintroduction = request.GET['bookintroduction']
bookprice = request.GET['bookprice']
booknum = request.GET['booknum']
except:
return HttpResponse('get error')
bookTypeFK = BookType.objects.get(TypeNum=booktype)
createBook = Book.objects.create(bookId=bookid,
bookName=bookname,
bookType=bookTypeFK,
bookPublisher=bookpublisher,
bookAuthor=bookauthor,
bookIntroduction=bookintroduction,
bookPrice=bookprice)
BookNum.objects.create(bookId=createBook,
bookNum=booknum)
AddItem.objects.create(bookId=createBook,
staffId=StaffInfo.objects.get(staffId=currentUser),
addNum=booknum)
return HttpResponse("success!!!")
else:
return HttpResponse("you do not have this perm")
else:
return HttpResponse("login Page,you are not login already")
def staffAddBookNum(request):#已存在Book类,添加addItem 更改或添加BookNum
if request.user.is_authenticated():
currentUser = request.user
if currentUser.is_staff:
if currentUser.has_perms(["main.add_additem","main.change_additem","main.add_booknum","main.change_booknum"]):
try:
try:
bookid = request.GET['bookid']
addBookNum = request.GET['addBookNum']
except:
return HttpResponse(bookid)
BookFK = Book.objects.get(bookId=bookid)
staffInfoFK = StaffInfo.objects.get(staffId=currentUser)
AddItem.objects.create(bookId=BookFK,staffId=staffInfoFK,addNum=addBookNum)
try:
changeBookNum = BookNum.objects.get(bookId__bookId=bookid)
changeBookNum.bookNum += int(addBookNum)
changeBookNum.save()
except:
BookNum.objects.create(bookId=BookFK,bookNum=addBookNum)
return HttpResponse("add success!")
except:
return HttpResponse('error GET')
else:
return HttpResponse("you do not have this perm")
else:
auth.logout(request)
return HttpResponse("you are not staff")
else:
return HttpResponse("login Page,you are not login already")
def staffBorrowUserBook(request):
if request.user.is_authenticated():
currentUser = request.user
if currentUser.is_staff:
if currentUser.has_perms(["main.add_borrowitem",'main.change_booknum']):
try:
bookid = request.GET['bookid']
userid = request.GET['userid']
except:
return HttpResponse('get error')
bookNumItem = BookNum.objects.get(bookId__bookId=bookid)
if bookNumItem.bookNum==0:
return HttpResponse("no more book avalible")
borrowitemsNum = len(BorrowItem.objects.all())
borrowitems = BorrowItem.objects.create(borrowItemId=borrowitemsNum+1,
bookId=Book.objects.get(bookId=bookid),
staffId=StaffInfo.objects.get(staffId=currentUser),
userId=UserInfo.objects.get(userId__username=userid),
hasReturned=False)
bookNumItem.bookNum -= 1
bookNumItem.save()
return HttpResponse(json.dumps({'end':True}),content_type="application/json")
else:
return HttpResponse("has no perm")
else:
return HttpResponse("you have no perm")
else:
return HttpResponse("login Page,you are not login already")
def staffReturnUserBook(request):
if request.user.is_authenticated():
currentUser = request.user
if currentUser.is_staff:
if currentUser.has_perms(["main.change_borrowitem"]):
try:
bookid = request.GET['bookid']
userid = request.GET['userid']
except:
return HttpResponse('get error')
bookNumItem = BookNum.objects.get(bookId__bookId=bookid)
borrowitems = BorrowItem.objects.filter(bookId__bookId=bookid,userId__userId__username=userid).exclude(hasReturned=True)
if len(borrowitems)==0:
return HttpResponse("you have not borrow this book")
for borrowitem in borrowitems:
if borrowitem.hasReturned:
continue
else:
borrowitem.hasReturned = True
borrowitem.save()
bookNumItem.bookNum += 1
bookNumItem.save()
return HttpResponse(json.dumps({'end':True}),content_type="application/json")
else:
return HttpResponse("has no perm")
else:
return HttpResponse("you have no perm")
else:
return HttpResponse("login Page,you are not login already")
def getTypeOptions(request):
if request.user.is_authenticated():
ans=[]
options = BookType.objects.all()
for option in options:
ans.append({"num":option.TypeNum,"optionName":option.TypeName})
return HttpResponse(json.dumps(ans),content_type="application/json")
else:
return HttpResponse("login Page,you are not login already")
def staffViewUserDetail(request):
if request.user.is_authenticated():
currentUser = request.user
if currentUser.is_staff:
try:
userid = request.GET['userid']
except:
return HttpResponseRedirect('/main')
currentLoginUser = {'userId':currentUser.username,
'userName':StaffInfo.objects.get(staffId=currentUser).staffName}
userAuth = authUser.objects.get(username=userid)
userInfoFK = UserInfo.objects.get(userId=userAuth)
borrowList = BorrowItem.objects.filter(userId=userInfoFK).order_by('borrowItemId')
userinfo = {'userid':userAuth.username,
'username':userInfoFK.userName,
'email':userAuth.email,
'sex':userInfoFK.userSex,
'age':userInfoFK.userAge,
'pn':userInfoFK.userPhoneNum,
'time':userInfoFK.userRegistTime.strftime('%Y-%m-%d')}
borrowInfoList = []
for i,borrowItem in enumerate(borrowList):
borrowInfoList.append({'bookName':borrowItem.bookId.bookName,
'itemNum':i+1,
'staffId':borrowItem.staffId.staffId.username,
'hasReturn':borrowItem.hasReturned})
borrowInfoList.reverse()
return render(request,'userDetail.html',{'userInfo':userinfo,'borrowList':borrowInfoList,'currentUser':currentLoginUser,'is_staff':True})
else:
userid = currentUser.username
currentLoginUser = {'userId':currentUser.username,
'userName':UserInfo.objects.get(userId=currentUser).userName}
userAuth = authUser.objects.get(username=userid)
userInfoFK = UserInfo.objects.get(userId=userAuth)
borrowList = BorrowItem.objects.filter(userId=userInfoFK).order_by('borrowItemId')
userinfo = {'userid':userAuth.username,
'username':userInfoFK.userName,
'email':userAuth.email,
'sex':userInfoFK.userSex,
'age':userInfoFK.userAge,
'pn':userInfoFK.userPhoneNum,
'time':userInfoFK.userRegistTime.strftime('%Y-%m-%d')}
borrowInfoList = []
for i,borrowItem in enumerate(borrowList):
borrowInfoList.append({'bookName':borrowItem.bookId.bookName,
'itemNum':i+1,
'staffId':borrowItem.staffId.staffId.username,
'hasReturn':borrowItem.hasReturned})
borrowInfoList.reverse()
return render(request,'userDetail.html',{'userInfo':userinfo,'borrowList':borrowInfoList,'currentUser':currentLoginUser,'is_staff':False})
else:
return HttpResponseRedirect("/login")
def staffViewUser(request):
if request.user.is_authenticated():
currentUser = request.user
if currentUser.is_staff:
try:
username = request.GET['username']
offset = request.GET['offset']
startPage = request.GET['startPage']
except:
return HttpResponse('startPage get error')
currentPage = int(startPage)
if username == '':
scanUser = UserInfo.objects.all().order_by('userName')
else:
scanUser = UserInfo.objects.filter(userName__contains = username)
userPagi = Paginator(scanUser,int(offset))
pageN = userPagi.page(currentPage)
after_range_num = 5
befor_range_num = 4
scanUserList = pageN.object_list
ansUserList = []
for userItem in scanUserList:
ansUserList.append({'userid':userItem.userId.username,
'username':userItem.userName,
'usersex':userItem.userSex,
'userage':userItem.userAge})
if currentPage-1>after_range_num:
pageList = userPagi.page_range[currentPage-1-after_range_num:currentPage-1+befor_range_num]
else:
pageList = userPagi.page_range[0:currentPage-1+befor_range_num]
ans = {'userList':ansUserList,'pageList':pageList,'currentPage':currentPage}
return HttpResponse(json.dumps(ans),content_type="application/json")
else:
return HttpResponse('not staff')
else:
return HttpResponse('not login')
def staffChangeBookInfo(request):
if request.user.is_authenticated():
currentUser = request.user
if currentUser.is_staff:
if currentUser.has_perms(["main.change_book","main.change_booknum"]):
try:
bookid = request.GET['bookid']
bookname = request.GET['bookname']
booktype = request.GET['booktype']
bookpub = request.GET['bookpublisher']
bookauthor = request.GET['bookauthor']
bookintro = request.GET['bookintroduction']
bookprice = request.GET['bookprice']
booknum = request.GET['booknum']
except:
return HttpResponse("get error")
bookFK = Book.objects.get(bookId=bookid)
bookNumFK = BookNum.objects.get(bookId__bookId=bookid)
bookFK.bookName = bookname
bookFK.bookType = BookType.objects.get(TypeNum=booktype)
bookFK.bookPublisher = bookpub
bookFK.bookAuthor = bookauthor
bookFK.bookIntroduction = bookintro
bookFK.bookPrice = bookprice
bookFK.save()
bookNumFK.bookNum = booknum
bookNumFK.save()
return HttpResponse("success!")
else:
return HttpResponse("has no perm")
else:
return HttpResponse("you have no perm")
else:
return HttpResponse("login Page,you are not login already")
-10
View File
@@ -1,10 +0,0 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Lib.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)