From f4a74ab15c67c02f99984aae3cceaa7fcf01a80d Mon Sep 17 00:00:00 2001 From: zhang200554 <lihuan.zhang@student.unimelb.edu.au> Date: Fri, 5 Oct 2018 22:19:32 +1000 Subject: [PATCH] test --- .idea/vcs.xml | 1 + .idea/workspace.xml | 289 +++++++++++++----- .../__pycache__/settings.cpython-37.pyc | Bin 2307 -> 2385 bytes PMPBackend/__pycache__/urls.cpython-37.pyc | Bin 1267 -> 1269 bytes PMPBackend/__pycache__/views.cpython-37.pyc | Bin 1219 -> 1269 bytes PMPBackend/settings.py | 22 +- PMPBackend/urls.py | 19 +- cargo/__init__.py | 0 cargo/__pycache__/__init__.cpython-37.pyc | Bin 0 -> 151 bytes cargo/__pycache__/admin.cpython-37.pyc | Bin 0 -> 192 bytes cargo/__pycache__/models.cpython-37.pyc | Bin 0 -> 1420 bytes cargo/__pycache__/views.cpython-37.pyc | Bin 0 -> 4761 bytes cargo/admin.py | 3 + cargo/apps.py | 5 + cargo/migrations/0001_initial.py | 60 ++++ cargo/migrations/0002_auto_20181005_0611.py | 23 ++ cargo/migrations/0003_auto_20181005_0942.py | 17 ++ cargo/migrations/__init__.py | 0 .../__pycache__/0001_initial.cpython-37.pyc | Bin 0 -> 1500 bytes .../0002_auto_20181005_0611.cpython-37.pyc | Bin 0 -> 625 bytes .../0003_auto_20181005_0942.cpython-37.pyc | Bin 0 -> 527 bytes .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 162 bytes cargo/models.py | 34 +++ cargo/tests.py | 3 + cargo/views.py | 210 +++++++++++++ 25 files changed, 584 insertions(+), 102 deletions(-) create mode 100644 cargo/__init__.py create mode 100644 cargo/__pycache__/__init__.cpython-37.pyc create mode 100644 cargo/__pycache__/admin.cpython-37.pyc create mode 100644 cargo/__pycache__/models.cpython-37.pyc create mode 100644 cargo/__pycache__/views.cpython-37.pyc create mode 100644 cargo/admin.py create mode 100644 cargo/apps.py create mode 100644 cargo/migrations/0001_initial.py create mode 100644 cargo/migrations/0002_auto_20181005_0611.py create mode 100644 cargo/migrations/0003_auto_20181005_0942.py create mode 100644 cargo/migrations/__init__.py create mode 100644 cargo/migrations/__pycache__/0001_initial.cpython-37.pyc create mode 100644 cargo/migrations/__pycache__/0002_auto_20181005_0611.cpython-37.pyc create mode 100644 cargo/migrations/__pycache__/0003_auto_20181005_0942.cpython-37.pyc create mode 100644 cargo/migrations/__pycache__/__init__.cpython-37.pyc create mode 100644 cargo/models.py create mode 100644 cargo/tests.py create mode 100644 cargo/views.py diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 6c0b863..288b36b 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ <project version="4"> <component name="VcsDirectoryMappings"> <mapping directory="$PROJECT_DIR$/.." vcs="Git" /> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> </component> </project> \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c820520..bfe55b2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,25 +2,10 @@ <project version="4"> <component name="ChangeListManager"> <list default="true" id="8e0a1b72-f07e-4c5d-8e03-75ac89ac3031" name="Default Changelist" comment=""> - <change afterPath="$PROJECT_DIR$/.idea/PMPBackend.iml" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/__init__.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/settings.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/templates/homePage.html" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/templates/lookUpBook.html" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/templates/newBook.html" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/templates/signIn.html" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/templates/signUp.html" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/templates/updateBook.html" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/templates/userProfile.html" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/templates/userUpdate.html" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/urls.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/views.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/PMPBackend/wsgi.py" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/db.sqlite3" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/manage.py" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/PMPBackend/settings.py" beforeDir="false" afterPath="$PROJECT_DIR$/PMPBackend/settings.py" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/PMPBackend/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/PMPBackend/urls.py" afterDir="false" /> </list> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="SHOW_DIALOG" value="false" /> @@ -35,43 +20,49 @@ <session id="-1540407213"> <usages-collector id="statistics.lifecycle.project"> <counts> + <entry key="project.closed" value="4" /> + <entry key="project.open.time.1" value="1" /> <entry key="project.open.time.16" value="1" /> - <entry key="project.opened" value="1" /> + <entry key="project.open.time.6" value="1" /> + <entry key="project.open.time.7" value="1" /> + <entry key="project.opened" value="4" /> </counts> </usages-collector> <usages-collector id="statistics.file.extensions.edit"> <counts> <entry key="html" value="181" /> - <entry key="py" value="1084" /> + <entry key="py" value="6122" /> + <entry key="txt" value="2" /> </counts> </usages-collector> <usages-collector id="statistics.file.types.edit"> <counts> <entry key="HTML" value="181" /> - <entry key="Python" value="1084" /> + <entry key="PLAIN_TEXT" value="2" /> + <entry key="Python" value="6122" /> </counts> </usages-collector> <usages-collector id="statistics.file.extensions.open"> <counts> - <entry key="html" value="13" /> - <entry key="py" value="4" /> + <entry key="html" value="14" /> + <entry key="py" value="11" /> </counts> </usages-collector> <usages-collector id="statistics.file.types.open"> <counts> - <entry key="HTML" value="13" /> - <entry key="Python" value="4" /> + <entry key="HTML" value="14" /> + <entry key="Python" value="11" /> </counts> </usages-collector> </session> </component> <component name="FileEditorManager"> - <leaf> + <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <file pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/PMPBackend/settings.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="339"> - <caret line="62" column="36" lean-forward="true" selection-start-line="62" selection-start-column="36" selection-end-line="62" selection-end-column="36" /> + <state relative-caret-position="-106"> + <caret line="42" lean-forward="true" selection-start-line="42" selection-end-line="42" /> </state> </provider> </entry> @@ -79,8 +70,8 @@ <file pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/PMPBackend/urls.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="420"> - <caret line="28" column="43" lean-forward="true" selection-start-line="28" selection-start-column="43" selection-end-line="28" selection-end-column="43" /> + <state relative-caret-position="375"> + <caret line="25" column="54" selection-start-line="25" selection-start-column="54" selection-end-line="25" selection-end-column="54" /> <folding> <element signature="e#635#667#0" expanded="true" /> </folding> @@ -88,19 +79,42 @@ </provider> </entry> </file> + <file pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/cargo/models.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="90"> + <caret line="6" column="26" selection-start-line="6" selection-start-column="26" selection-end-line="6" selection-end-column="26" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="true"> + <entry file="file://$PROJECT_DIR$/cargo/views.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="376"> + <caret line="77" column="32" lean-forward="true" selection-start-line="77" selection-start-column="32" selection-end-line="77" selection-end-column="32" /> + <folding> + <element signature="e#0#45#0" expanded="true" /> + <marker date="1538741737406" expanded="true" signature="674:1340" ph="..." /> + <marker date="1538741737406" expanded="true" signature="3852:5054" ph="..." /> + <marker date="1538741737406" expanded="true" signature="5769:6475" ph="..." /> + </folding> + </state> + </provider> + </entry> + </file> <file pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/PMPBackend/wsgi.py"> <provider selected="true" editor-type-id="text-editor" /> </entry> </file> - <file pinned="false" current-in-tab="true"> + <file pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/PMPBackend/views.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="420"> - <caret line="28" column="24" lean-forward="true" selection-start-line="28" selection-start-column="24" selection-end-line="28" selection-end-column="24" /> + <state relative-caret-position="30"> + <caret line="2" selection-start-line="2" selection-end-line="2" /> <folding> <marker date="1538386992227" expanded="true" signature="556:604" ph="..." /> - <marker date="1538386992227" expanded="true" signature="702:750" ph="..." /> </folding> </state> </provider> @@ -108,7 +122,41 @@ </file> <file pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/manage.py"> - <provider selected="true" editor-type-id="text-editor" /> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="195"> + <caret line="14" column="39" selection-start-line="14" selection-start-column="39" selection-end-line="14" selection-end-column="39" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file:///usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-186"> + <caret line="5" selection-start-line="5" selection-end-line="5" /> + <folding> + <element signature="e#104#113#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file:///usr/local/lib/python3.7/site-packages/django/utils/autoreload.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="210"> + <caret line="224" selection-start-line="224" selection-end-line="224" /> + </state> + </provider> + </entry> + </file> + <file pinned="false" current-in-tab="false"> + <entry file="file:///usr/local/lib/python3.7/site-packages/django/db/utils.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="240"> + <caret line="203" column="31" selection-start-line="203" selection-start-column="31" selection-end-line="203" selection-end-column="31" /> + </state> + </provider> </entry> </file> </leaf> @@ -117,16 +165,16 @@ <option name="RECENT_TEMPLATES"> <list> <option value="HTML File" /> + <option value="Python Script" /> </list> </option> </component> <component name="Git.Settings"> - <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." /> + <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> </component> <component name="IdeDocumentHistory"> <option name="CHANGED_PATHS"> <list> - <option value="$PROJECT_DIR$/PMPBackend/settings.py" /> <option value="$PROJECT_DIR$/PMPBackend/templates/homePage.html" /> <option value="$PROJECT_DIR$/PMPBackend/templates/SignUp.html" /> <option value="$PROJECT_DIR$/PMPBackend/templates/SignIn.html" /> @@ -139,8 +187,12 @@ <option value="$PROJECT_DIR$/PMPBackend/templates/updatebook.html" /> <option value="$PROJECT_DIR$/PMPBackend/templates/updateBook.html" /> <option value="$PROJECT_DIR$/PMPBackend/templates/lookUpBook.html" /> - <option value="$PROJECT_DIR$/PMPBackend/urls.py" /> <option value="$PROJECT_DIR$/PMPBackend/views.py" /> + <option value="$PROJECT_DIR$/PMPBackend/models.py" /> + <option value="$PROJECT_DIR$/PMPBackend/settings.py" /> + <option value="$PROJECT_DIR$/cargo/models.py" /> + <option value="$PROJECT_DIR$/PMPBackend/urls.py" /> + <option value="$PROJECT_DIR$/cargo/views.py" /> </list> </option> </component> @@ -150,11 +202,21 @@ <detection-done>true</detection-done> <sorting>DEFINITION_ORDER</sorting> </component> - <component name="ProjectFrameBounds"> - <option name="x" value="113" /> - <option name="y" value="34" /> - <option name="width" value="1400" /> - <option name="height" value="908" /> + <component name="ProjectFrameBounds" fullScreen="true"> + <option name="width" value="1680" /> + <option name="height" value="1050" /> + </component> + <component name="ProjectInspectionProfilesVisibleTreeState"> + <entry key="Project Default"> + <profile-state> + <expanded-state> + <State /> + <State> + <id>SQL</id> + </State> + </expanded-state> + </profile-state> + </entry> </component> <component name="ProjectLevelVcsManager" settingsEditedManually="true" /> <component name="ProjectView"> @@ -162,7 +224,6 @@ <foldersAlwaysOnTop value="true" /> </navigator> <panes> - <pane id="Scope" /> <pane id="ProjectPane"> <subPane> <expand> @@ -170,6 +231,11 @@ <item name="PMPBackend" type="b2602c69:ProjectViewProjectNode" /> <item name="PMPBackend" type="462c0819:PsiDirectoryNode" /> </path> + <path> + <item name="PMPBackend" type="b2602c69:ProjectViewProjectNode" /> + <item name="PMPBackend" type="462c0819:PsiDirectoryNode" /> + <item name="cargo" type="462c0819:PsiDirectoryNode" /> + </path> <path> <item name="PMPBackend" type="b2602c69:ProjectViewProjectNode" /> <item name="PMPBackend" type="462c0819:PsiDirectoryNode" /> @@ -185,6 +251,7 @@ <select /> </subPane> </pane> + <pane id="Scope" /> </panes> </component> <component name="PropertiesComponent"> @@ -247,30 +314,30 @@ <servers /> </component> <component name="ToolWindowManager"> - <frame x="113" y="34" width="1400" height="908" extended-state="0" /> + <frame x="0" y="0" width="1680" height="1050" extended-state="0" /> <editor active="true" /> <layout> - <window_info id="Favorites" side_tool="true" /> - <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2496318" /> + <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.21611722" /> <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" show_stripe_button="false" /> - <window_info anchor="bottom" id="Version Control" show_stripe_button="false" /> - <window_info anchor="bottom" id="Python Console" /> - <window_info active="true" anchor="bottom" id="Terminal" visible="true" weight="0.32965687" /> - <window_info anchor="bottom" id="Event Log" side_tool="true" /> + <window_info id="Favorites" order="2" 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.32965687" /> + <window_info anchor="bottom" id="Run" order="2" weight="0.32959184" /> <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" /> + <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> + <window_info anchor="bottom" id="Version Control" order="8" show_stripe_button="false" /> + <window_info anchor="bottom" id="Database Changes" order="9" show_stripe_button="false" /> + <window_info anchor="bottom" id="Event Log" order="10" side_tool="true" /> + <window_info anchor="bottom" id="Terminal" order="11" weight="0.32965687" /> + <window_info anchor="bottom" id="Python Console" order="12" /> <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" /> + <window_info anchor="right" id="SciView" order="3" /> + <window_info anchor="right" id="Database" order="4" /> </layout> </component> <component name="TypeScriptGeneratedFilesManager"> @@ -280,13 +347,6 @@ <option name="myLimit" value="2678400000" /> </component> <component name="editorHistoryManager"> - <entry file="file://$PROJECT_DIR$/PMPBackend/templates/homePage.html"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="1275"> - <caret line="85" column="17" lean-forward="true" selection-start-line="85" selection-start-column="17" selection-end-line="85" selection-end-column="17" /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/PMPBackend/templates/signIn.html"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="60"> @@ -308,19 +368,6 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/PMPBackend/wsgi.py"> - <provider selected="true" editor-type-id="text-editor" /> - </entry> - <entry file="file://$PROJECT_DIR$/manage.py"> - <provider selected="true" editor-type-id="text-editor" /> - </entry> - <entry file="file://$PROJECT_DIR$/PMPBackend/settings.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="339"> - <caret line="62" column="36" lean-forward="true" selection-start-line="62" selection-start-column="36" selection-end-line="62" selection-end-column="36" /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/PMPBackend/templates/userProfile.html"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="60"> @@ -349,23 +396,97 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/PMPBackend/urls.py"> + <entry file="file://$PROJECT_DIR$/PMPBackend/templates/homePage.html"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="1275"> + <caret line="85" column="17" selection-start-line="85" selection-start-column="17" selection-end-line="85" selection-end-column="17" /> + </state> + </provider> + </entry> + <entry file="file:///usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="420"> - <caret line="28" column="43" lean-forward="true" selection-start-line="28" selection-start-column="43" selection-end-line="28" selection-end-column="43" /> + <state relative-caret-position="-186"> + <caret line="5" selection-start-line="5" selection-end-line="5" /> <folding> - <element signature="e#635#667#0" expanded="true" /> + <element signature="e#104#113#0" expanded="true" /> </folding> </state> </provider> </entry> + <entry file="file:///usr/local/lib/python3.7/site-packages/django/utils/autoreload.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="210"> + <caret line="224" selection-start-line="224" selection-end-line="224" /> + </state> + </provider> + </entry> + <entry file="file:///usr/local/lib/python3.7/site-packages/django/db/utils.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="240"> + <caret line="203" column="31" selection-start-line="203" selection-start-column="31" selection-end-line="203" selection-end-column="31" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/PMPBackend/models.py"> + <provider selected="true" editor-type-id="text-editor"> + <state> + <caret selection-end-line="31" selection-end-column="47" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/PMPBackend/wsgi.py"> + <provider selected="true" editor-type-id="text-editor" /> + </entry> <entry file="file://$PROJECT_DIR$/PMPBackend/views.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="420"> - <caret line="28" column="24" lean-forward="true" selection-start-line="28" selection-start-column="24" selection-end-line="28" selection-end-column="24" /> + <state relative-caret-position="30"> + <caret line="2" selection-start-line="2" selection-end-line="2" /> <folding> <marker date="1538386992227" expanded="true" signature="556:604" ph="..." /> - <marker date="1538386992227" expanded="true" signature="702:750" ph="..." /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/manage.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="195"> + <caret line="14" column="39" selection-start-line="14" selection-start-column="39" selection-end-line="14" selection-end-column="39" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/PMPBackend/settings.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-106"> + <caret line="42" lean-forward="true" selection-start-line="42" selection-end-line="42" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/cargo/models.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="90"> + <caret line="6" column="26" selection-start-line="6" selection-start-column="26" selection-end-line="6" selection-end-column="26" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/PMPBackend/urls.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="375"> + <caret line="25" column="54" selection-start-line="25" selection-start-column="54" selection-end-line="25" selection-end-column="54" /> + <folding> + <element signature="e#635#667#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/cargo/views.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="376"> + <caret line="77" column="32" lean-forward="true" selection-start-line="77" selection-start-column="32" selection-end-line="77" selection-end-column="32" /> + <folding> + <element signature="e#0#45#0" expanded="true" /> + <marker date="1538741737406" expanded="true" signature="674:1340" ph="..." /> + <marker date="1538741737406" expanded="true" signature="3852:5054" ph="..." /> + <marker date="1538741737406" expanded="true" signature="5769:6475" ph="..." /> </folding> </state> </provider> diff --git a/PMPBackend/__pycache__/settings.cpython-37.pyc b/PMPBackend/__pycache__/settings.cpython-37.pyc index c967042f833771514f9819f3b9136e876ddfd935..8617d40c248557a2f35b7cf5c8571dde80319b2d 100644 GIT binary patch delta 485 zcmZn`x+uiw#LLUYz`(#@!@oURjdvoS1mmrV>c;gctm%wVoGEN6>?s^6oGDx>+$lUM zyy+ZKTq%4h{3!w{f+<2N!s%>L+$kbaJSn27j9E+zcvIO@#KajEGNv=8u%w8mNTf)n zNTo=pvt%-+$jo6$XN=-Yk&WU{kxP+JQAklpQA|-vQBF~r!<NYyC6J<;qL#^+qMD+f z$(W+6nxX;bXl62|vqTA|XhjL7Xh#XButbTZutbTbutbTa=tPO9Fa<Mc>TYIXEMVm2 zF*MLKG}bdTFx9g#m|V;>O+1RPD7CmGKCLJ*H?=&!C_9QZIk6}`e=;ZY#LY*U#hB_P zQnC{B()0CFlJt@ile1IvQi}C*D~k(rqS$jXGfETls;cBN^V0H-3=9m6Q<C&j^V0Q7 z^D=W&bCUE@Q%dy`OQX1|ax#nz3{0zXGBRKBFfeGc-C}d~bNBRfy~X0^=<9lmB{bMI z=oX8Ie{jexjsVBt;BfySms>0W{y`z^MeGa=3{@VJ4Om4s>#`{_u_-e!Fcc|I4&jJY zi(z13U}555mSJaMW?^DuV`4;xY%E|N)8vaBax!2hBNHPR7aKDOa&fRQK_MFeLpyS` delta 368 zcmca8)GWm3#LLUYz`(#T?fJ&&V4jJ55{x${svFm*GemKwu%@u3u%~dOaHepjvqf>G zaHsI3@TTyk@TUl*2&S_~ai<7H@uUc+GG;L?;7w&q5fNut$e7NU!jdAIB9<baB9S7Q z&XUQPA~lC4oiU0pMLLQ<MJ7cSu3l~-Q;Pf?rcA~tffR)l#Z1N&g%l+)sjUpAR5BUU zS)v3}RHKAa)S`q_SfWHySfWHzSfa#I)T6{xn1UHJH8!&`7BEh3VVXMGfO+ENY0M%# z#YJg)&c#J(VVSAro3}A5GMP)IWF_XM=j){;=_Ms5XQ$?+6zdfi=46(n8dq_pB*EC4 zOt;uv{oFnMTyL@XIr_S84r8-nVv}cJU?`HGJcA=rC5VB6frW{KS%#g3nT3gkjfoKk Z*;rt#$>N-HA|hOD%pl0c!NLTEYyfa}Qv?72 diff --git a/PMPBackend/__pycache__/urls.cpython-37.pyc b/PMPBackend/__pycache__/urls.cpython-37.pyc index af9d35153d71dab7ad39345d15ee345ace37d15b..6136e6f4b4699f6022f4f9ebeb8f7e3d456a341f 100644 GIT binary patch delta 456 zcmey&`IS@MiI<m)fq{YHqQ~~=J{AUs#~=<2gJc{S7#NBhCaP=1vNJNIvZS!4vS)EL zGo`Ymu%)tRae`Uwsq9%?U=~LzdlomC#hJ>U#RFz>rLt%7f?3?D>{)zZ7EdaB7JoBS zI!Ba13U4rjCf~*#)0yh41QH7}^-GIWi}VYM^3yVNQmgpkBBcc>i6zJa#hK}OnR!Sm zKmw%&Re~TbN%{HNnR)5@$r-81*;PU)LPe<{gHXi4hV!RZ@qiQ-XJi(5=B4FNzQSx= ze~UFau_!&ih=qZHA&Lvk4$Dj}FOFh|Ix&hDtT`3NWdk|GGcO8EhZaO}r(_lv<Rn&t zTolEgms$>Ha6vSI*&HwnZ*i9v<rE~Al%y8r6|ZC{;$&c8W+>vE+{6+pCC0$Oz{14C M$iv9P%*BWd0oYN81^@s6 delta 413 zcmey$`I%GQiI<m)fq{Wx=If2oMJx;qk3k$5=4N1EaA06yDDIi4u93;c$dJmC!kWsK z#oo-6%96sC%9h0eX0fNTWpRR89I0$sTwoR_oW+&Omc<Pg<4$GE;sLXGQrWV2!7ScX zrYycJ{${3h&M1KtzF-DT{*7y<Gu7W>sNyOuPA$^U$xqMBtKtT;i!;;nN(-uZz?_1j z{ItxR)G8q`ue2Z~u_P5PmXx2Lotc-e52ADO^Rr6}s)RvokXUYFb}E!zB?@KeL-a#= zRcvgDDY=<>`jam*8#_dC1^5OyB_?O5=B0qbh#`t2BR@B_ATd2PiVftX%sdEPS`Y<x zC)5>DTo9Wl`?5$X-C`-uEJ?k^Qd*Q#e2crZD5oH?q$IT{uXrUx5h$FCxF@%<gfdD@ LzQZEP#Ki~zs6~D$ diff --git a/PMPBackend/__pycache__/views.cpython-37.pyc b/PMPBackend/__pycache__/views.cpython-37.pyc index 1ffbf6a09262a8c3d90d9e636cb38d90b73c7477..a30f6e801cc757af695bc0ade8d814982e1870d7 100644 GIT binary patch delta 258 zcmX@i`IVE`iI<m)fq{X+;LXP9cN=+~8B>@T7#LU>7#N%x7#NBr7#J8b8EP3*7;6|) zm~0qI7-|?&m}?lDnS&WLS^TO5eDc#X^Av(hlao`6i_=PTZm}0b*j3!cndy0+d3qTo zxjCAQMId7}nTnVh7#NCJCckHtm^_b>oreu%HzNxp2V)WE<VGg#$@z?|lkYO>F!D_< zWip@a$YjhYIQbcq#pJb27K|d3!<o$|%Q9OsicdbpY(BY<*_u}h<Vuj)42(s5lN*_I hCNr^E@X8{I@=tbWQJ$R7BFD%-xsyeoo0WqZ1_9TEIDY^D delta 158 zcmey$d6<*eiI<m)fq{WR@%6^&6&rb-87IGHRAKVWn=Htr!JnDO$-ux+%mh-vSi~{; zK4T0Q4_svO9Y(#$#Z1PG{F7~%%qQPtvSbvRyqw8masaahqv&J_X7kAhn5`KlCU-KM pPc~+;<dueNWh~;GT*;!$$T4{aixMO2WJM<7$(LEgxtTfO5CB7YAmac4 diff --git a/PMPBackend/settings.py b/PMPBackend/settings.py index 64766d7..1a807e4 100644 --- a/PMPBackend/settings.py +++ b/PMPBackend/settings.py @@ -25,7 +25,7 @@ SECRET_KEY = '84rci9)9prwn$cd!gv2g3^7s0)^a9_o30!k6iwy=wdav9+p7g#' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['10.13.105.80'] # Application definition @@ -37,13 +37,15 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'rest_framework', + 'cargo', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', + #'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', @@ -70,14 +72,18 @@ TEMPLATES = [ WSGI_APPLICATION = 'PMPBackend.wsgi.application' - -# Database -# https://docs.djangoproject.com/en/2.1/ref/settings/#databases - DATABASES = { + # 'default': { + # 'ENGINE': 'django.db.backends.sqlite3', + # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + # } 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'lihuanz', + 'USER': 'lihuanz', + 'HOST': 'info20003db.eng.unimelb.edu.au', + 'PASSWORD': 'zlh2005zlh', + 'PORT': 3306, } } diff --git a/PMPBackend/urls.py b/PMPBackend/urls.py index 7c03c40..a62a477 100644 --- a/PMPBackend/urls.py +++ b/PMPBackend/urls.py @@ -16,18 +16,17 @@ Including another URLconf from django.contrib import admin from django.urls import path -from PMPBackend import views +from cargo import views as cargoViews urlpatterns = [ - path('', views.homepage), - path('user/login', views.signin), - path('user/signup', views.signup), - path('user/profile', views.userprofile), - path('user/updateprofile', views.userprofile), - path('booking/booklookup', views.lookupbook), - path('booking/makebooking', views.newbook), - path('booking/updatebooking', views.updatebook), - path('admin/', admin.site.urls), + path('api/user/profile', cargoViews.profile), + path('api/user/update', cargoViews.updateprofile), + path('api/user/signin', cargoViews.signIn), + path('api/user/signup', cargoViews.signUp), + path('api/booking/check', cargoViews.displaybook), + path('api/booking/create', cargoViews.newbook), + path('api/booking/update', cargoViews.updatebook), + path('api/shipInfo', cargoViews.shipInfo), ] diff --git a/cargo/__init__.py b/cargo/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cargo/__pycache__/__init__.cpython-37.pyc b/cargo/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c00edd3425d1db03025622df32c27973a1d219a6 GIT binary patch literal 151 zcmZ?b<>g{vU|{(6Wm`0eeheaDn2~{j!GVE+p_qk%fgyz<m_d`#ZzV$!NEku<a?lSg zPAw|d&&kX#FU?ENNG;7v*AJ*n&PXiE4JgXbN=+^))(`Lva7s+hPR&cvPfjdK&)1KS d&&<m#iI3MSsJz8tlbfGXnv-e=GPxLJI{<oFCIkQg literal 0 HcmV?d00001 diff --git a/cargo/__pycache__/admin.cpython-37.pyc b/cargo/__pycache__/admin.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0be9f2f83db4ecb506c6ad230410ef34be78467c GIT binary patch literal 192 zcmZ?b<>g{vU|{(6Wm~j80|Ucj5C?{t7#J8F7#J9e1sE6@QW#Pga~N_NqZk<(Qka4n zG?`z5)M+x_VoglR&CK)DWQyWT$x6&i&(}-N&nqd)Oez8yu#%yOnSlX9{Ib;#Elw>e z*3ZezE-%eX&PXlIOV<ymOwLFw$_*&W&q_@$Db^404RA_K&Q8rs(N9h+O3&8^o3B?; Ud5gm)H$SB`C)JJ-<SLN$0NETdP5=M^ literal 0 HcmV?d00001 diff --git a/cargo/__pycache__/models.cpython-37.pyc b/cargo/__pycache__/models.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f64e7da019efcf49d04224047c52b157bcbdbd3c GIT binary patch literal 1420 zcmZ?b<>g{vU|=|CxIOwa3j@Pr5C?`?7#J8F7#J9e-53}cQW#Pga~N_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3no%o_dR|xFoTpv^a_-Ils8%7B48mLo#!riGT}Y z07x*3*~7^viWihv;F=+60F*HxEO2U&WME(b#eT5_G&Kk?3NWH3bw0)-kSae-wp*Mj xS&4b+`FbfykbKSR3o6gR!3+smkV1&*sP^3Auz{2hcAx^K7!>k6%tG8k>;OiaOu+yE literal 0 HcmV?d00001 diff --git a/cargo/__pycache__/views.cpython-37.pyc b/cargo/__pycache__/views.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3d6ed7e014f08d9b91e1c82f70bdda25e25c1666 GIT binary patch literal 4761 zcmZ?b<>g{vU|@I|x;@%kl7Zndhy%k+3=9ko3=9m#Jq!#CDGVu$ISjdsQH;4vQA~^= zK2r{J6mtqg3UdxiE^8EPE?X2^E_)O^RE{HxBZVP_C5JPYD~by$#vR3-!kWU?!Vtxi z!k)s>!Vtxq!kNO=!Vtxm!kxm?!Vtxu!kfa^!Vo2p!k;40!Vo2xBA6o7!Vo2tBAg=9 z!Vo2#!W7J)Df$xRMop$$Y(=SgDXB%bIEqqJGK*4^OZ+sMZ?TjXgM^ARG7EB3^Ga@U z7o`@KrWThZ<>zN>GT!3xC@CojN-ZwP&nr$%W(1kUz`(%9z`(%Hz`)=P@^A$M149i% z7DEbSHd9ea31b%10_KGbwTvY!S*#1#7BbW_r8CqrSD4f=xiG}))UwntFJP}>$>K<1 zs$t3ET)?%EL7X9lS)8GUC5s!vOJ`ch$jDHr5zbJ<oWhdAI)|y2wS=dHcL84w>q5p9 zwiNbWreKB?hF}Iw4!>K>?yezKtZqg5xe8S*3L*Ilw-^mHnQn1_yyTgemVb+_xFoTp zw75zjv7jI)GdZy&Ge1v1t2jRo<iF(nypq(slK7I!f>cfZTWq<hB^miCw>VM~OHxZR zb5n1zfLOO!OY&0^D~nhe7#MD`=O<;QCYKc7VouD-xy6=PP>`CJa*GROA1DYtU2bva zq$ZZ7x+IpQ-eQlBFD@yHkH5v0SX7h=5iA0Q-7OZ76K=7ll;#!`YqH&9hX#C+00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LE&gPvH+@r!ixbmRA$Ft|LAgclAl;yJ49SJy{KF0|2#dg3 z#{(n}&N`qX?iL#)P;W68mlQ!-OyIT?xY@*=l384klUNCIVJj#rfeHdpR^nrnVB}!} z6^vYrB8)OjkfISr3W4i27DfR`1`9&YV4%DY!r+2(1#$*kf>}^DgBrJNHH-_`K`pCh zP}>SrpK+uxi!jtM#dDTG<XAvOX$@067nIKm<%5b!_7q4P3sh9Hr+|u0rg&bkiJ)SW zDW0!}X#qb<vB_K_P{O!C5S%fv6q`|?gbQg9y#zH{qTt<-%oK2@DFVeDEEz*vOi^6P zrQoEQTbvF~dqtp-gf^E56sbs!pCYs(6`bP0i4t6{g3}E+`aMB$4C)+%9aH23;`)II zv~m?vL4wQGTcFkrD59}djYT003=GRbDFBpaKq)|gk&Q`!k%v)$5k!ItRcLVvQi;-v zhR60Q<k((@8Qb8>j9|4`!d1hZ#aY6g#goF?%f!e4)&=V1@GfMkVFt%7TMBy(a~2<% z&j*(0sA10H2lM%Bn4xWFL^UZ`!ni;PXEo^rs{9y>yg)q<E>Hkv=B0Z$`DilUVgWT4 zia;qjN)Rd$04}`1C6pvo2&sUAmO-SZ0AWb!18V-FrvOCcgVO@IiR29~EDDM;^Ga?p z7grX8y5lLSMMdBe23(XB`C~~7NOdeIjpt{BTTD^xAa6LA7GX;kx40m+El9~8Q0hRh zYC)+(fKh-6nl?ZUD@~Coft0Moy!3p%;*9*FlH}5o;vy!Hdze84A1Ii4z@2Bk-29Z( zoMK4h4^)~Kf&B;yhFjcFBQi=#3Lp*laFA|LFB{yC12?9NKuxqFQ2ky6Ducj@xCrD1 yq;d{X*m2n8=BJeAq}qXMyJC<}1Q<COMHo34c^ElZIRrQ)IaE2sIYc>>I79)|dp6<# literal 0 HcmV?d00001 diff --git a/cargo/admin.py b/cargo/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/cargo/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cargo/apps.py b/cargo/apps.py new file mode 100644 index 0000000..4e0480a --- /dev/null +++ b/cargo/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class CargoConfig(AppConfig): + name = 'cargo' diff --git a/cargo/migrations/0001_initial.py b/cargo/migrations/0001_initial.py new file mode 100644 index 0000000..0010817 --- /dev/null +++ b/cargo/migrations/0001_initial.py @@ -0,0 +1,60 @@ +# Generated by Django 2.1.1 on 2018-10-05 05:42 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='request', + fields=[ + ('bookID', models.AutoField(primary_key=True, serialize=False)), + ('boxNumber', models.IntegerField()), + ('destination', models.CharField(max_length=150)), + ('pickup', models.CharField(max_length=150)), + ('customerMessage', models.TextField(null=True)), + ('status', models.IntegerField(default=0, max_length=1)), + ('cost', models.IntegerField(null=True)), + ('pickupDate', models.DateTimeField(null=True)), + ('HBL', models.CharField(max_length=30, null=True)), + ('shiperMessage', models.TextField(null=True)), + ], + ), + migrations.CreateModel( + name='shipment', + fields=[ + ('shipmentID', models.AutoField(primary_key=True, serialize=False)), + ('leaveDate', models.DateField()), + ('arriveDate', models.DateField()), + ], + ), + migrations.CreateModel( + name='user', + fields=[ + ('userID', models.AutoField(primary_key=True, serialize=False)), + ('email', models.CharField(max_length=50)), + ('password', models.CharField(max_length=20)), + ('userType', models.IntegerField(default=0, max_length=1)), + ('userName', models.CharField(max_length=30)), + ('phoneNumber', models.CharField(max_length=20)), + ('homeAddress', models.CharField(max_length=150)), + ], + ), + migrations.AddField( + model_name='request', + name='shipmentID', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cargo.shipment'), + ), + migrations.AddField( + model_name='request', + name='userID', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cargo.user'), + ), + ] diff --git a/cargo/migrations/0002_auto_20181005_0611.py b/cargo/migrations/0002_auto_20181005_0611.py new file mode 100644 index 0000000..3601685 --- /dev/null +++ b/cargo/migrations/0002_auto_20181005_0611.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1.1 on 2018-10-05 06:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cargo', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='request', + name='status', + field=models.IntegerField(default=0), + ), + migrations.AlterField( + model_name='user', + name='userType', + field=models.IntegerField(default=0), + ), + ] diff --git a/cargo/migrations/0003_auto_20181005_0942.py b/cargo/migrations/0003_auto_20181005_0942.py new file mode 100644 index 0000000..ae01614 --- /dev/null +++ b/cargo/migrations/0003_auto_20181005_0942.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.1 on 2018-10-05 09:42 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('cargo', '0002_auto_20181005_0611'), + ] + + operations = [ + migrations.RenameModel( + old_name='request', + new_name='requestbook', + ), + ] diff --git a/cargo/migrations/__init__.py b/cargo/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cargo/migrations/__pycache__/0001_initial.cpython-37.pyc b/cargo/migrations/__pycache__/0001_initial.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..333e6a4e7f02bdb33eebc61f5b46f3155e950b7b GIT binary patch literal 1500 zcmZ?b<>g{vU|?ADb6fOB4hDwDAPx+(FfcGUFfcF_>oG7eq%fo~<}l<kMlt3xMKLjg z_)Iy>Q7rBZDa<J>Eet6vsf<~y&CF4(DNMl(nyfEDrf4$V;>yiTFG?)Q%+D*n#g?0& zlA2TOmkg4FVSbn`Qy3W-QW>HcQy8L{QW&F{(;1>zQdzUuQkYVhQ`xgPQW#TMQdoPL z(wI`%QrQ=9E@Vh!N?}iB&*DnqNa5^dOk+ynLg8_zvS)FpFsAT;<#<!svp7@uQutE@ zz-9=7`7l|bRQ4<$xLRSbIU*^HDWYJtV#p??bESy)GJ#ztks^uaGO1Md1-xLFNyAv_ z%y9KGDY9tl<-j({L*1_c<|#sXN?;cvT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rations/__pycache__/0002_auto_20181005_0611.cpython-37.pyc b/cargo/migrations/__pycache__/0002_auto_20181005_0611.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d5010fc29499beeb9e7b69771c69128ee52d193 GIT binary patch literal 625 zcmZ?b<>g{vU|^WZusxcWiGkrUhy%kc3=9ko3=9m#Y77hvDGVu$ISjdsQH;4vQA~^s z?hGkRDa<VlDa@&iS<KDMQOqeU!3>(LFG0FBnQn3AW~LV<mSpDV72jgZ%}+_qDNY7S z!7w|_a3=-^hE#?q#uSDqrWD3>#wg}gmMm6~;i+s{>?tfMti6mWY`qXs_7o0O(R8LL zjug&d22HM8oW3v{HJNU)CMOo9=ilNnFfcHT&&<m#$xO_-#a@(JSejZ~a*M6FB(bEl zxQLN~fkBh;7JEu+T4HHVi6-+cF0fPM^AdAYZ?S+$*0jvjoRnKErNya5w>Us#NM%8) zpC;!mj(D)T`1o5~@$tF&DWy57@$t8K;^PZT6LUa%LA;dIg4Dc})V$=()Z!v01_p*( zT#h*<sYPxeQ;V2E0z961C8_C9p<7(}1*y=0Tggx)#=rm}enshr7N-^!>*r)<mzU-x zXQY<qrRxV&CTAoT<pvbxXQd{W6zd201~?@qXQ$?+=z{}59}x@s1_lO3@rk7+`SC^u zh8Bhf2Bz@_W`>4(1(ijhm}UdTv=9RW0|zr33kxF?BNHPZ6NCoK`)RV=;!Md(%uCPL hOGyHI1?+sVB*L8#mN>{?95#?Zu><+C802>WW&nHDq+<X8 literal 0 HcmV?d00001 diff --git a/cargo/migrations/__pycache__/0003_auto_20181005_0942.cpython-37.pyc b/cargo/migrations/__pycache__/0003_auto_20181005_0942.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..42d2036524668946e59506700688b146e4574835 GIT binary patch literal 527 zcmZ?b<>g{vU|@J}xINmBk%8echy%kc3=9ko3=9m#N(>APDGVu$ISjdsQH+cX?hGkR zDa<VlDa@&iSxn8$QA{Z;!3>(LFF`sr8E<jrW~LV<mSpDV6(@s)U>L=~RE8+V6ox3K z6vlMMDCSg_ELM=ADJ;EA>5NfqDXhT^nryc?ePJePGTmZLPAp2#za?&9U|<xVSXz=F zZ)9L-VQ64r8gF1`Xn2dgD7COOwYcOKH<Xc-pP#MCbc-WDCnY{FF*o%VM_y_<nB}L* zev2a>%#4q}#T6f)o1apelNuj?izhz5urx6Tq#VRcNi9gtOG(X3&P**XVq#!mxWyfm z3X=5APf5+W#g$)>3iatqh9Ut51_<#hN<XwXwWwG>Co{XeG%q<LwKOkXKcF%>Be5tq zpeR2pHMyi%KfpJ@DKR-aH7`XU>@$5tu<08Z7#O4b(bB|7ub{GsnSp_U4HPXL3=9k$ z%xo+yj7*GRQ9n)QTbwCbiFxVydMQa@=Yqu%4uh}+LH^*df%w@DWL`1IYdp*VyxxiX literal 0 HcmV?d00001 diff --git a/cargo/migrations/__pycache__/__init__.cpython-37.pyc b/cargo/migrations/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..384dd58025beed8d8f708f54e9809b9fd40cabc0 GIT binary patch literal 162 zcmZ?b<>g{vU|{(6Wm`0eeheaDn2~{j!GVE+p_qk%fgyz<m_d`#ZzV$!NEku<^41S6 zPAw|d&&kX#FU?ENNG;7v*AJ*n&PXiE4JgXbN=+^))(`Lva7s+hPR&cvPfjdK&)3h* oOfO0-$;{6y){l?R%*!l^kJl@xyv1RYo1apelWGUDq!{E70Ae62djJ3c literal 0 HcmV?d00001 diff --git a/cargo/models.py b/cargo/models.py new file mode 100644 index 0000000..d2150d1 --- /dev/null +++ b/cargo/models.py @@ -0,0 +1,34 @@ +from django.db import models + +# Create your models here. +class user(models.Model): + userID = models.AutoField(primary_key=True) + email = models.CharField(max_length=50) + password = models.CharField(max_length=20) + userType = models.IntegerField(default=0) + userName = models.CharField(max_length=30) + phoneNumber = models.CharField(max_length=20) + homeAddress = models.CharField(max_length=150) + + +# Create your models here. +class shipment(models.Model): + shipmentID = models.AutoField(primary_key=True) + leaveDate = models.DateField() + arriveDate = models.DateField() + + +# Create your models here. +class requestbook(models.Model): + bookID = models.AutoField(primary_key=True) + userID = models.ForeignKey('user', on_delete=models.CASCADE) + shipmentID = models.ForeignKey('shipment', on_delete=models.CASCADE) + boxNumber = models.IntegerField() + destination = models.CharField(max_length=150) + pickup = models.CharField(max_length=150) + customerMessage = models.TextField(null=True) + status = models.IntegerField(default=0) + cost = models.IntegerField(null=True) + pickupDate = models.DateTimeField(null=True) + HBL = models.CharField(max_length=30, null=True) + shiperMessage = models.TextField(null=True) diff --git a/cargo/tests.py b/cargo/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/cargo/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cargo/views.py b/cargo/views.py new file mode 100644 index 0000000..f1c5ae9 --- /dev/null +++ b/cargo/views.py @@ -0,0 +1,210 @@ +from django.shortcuts import render, redirect +import datetime +from cargo.models import user, shipment, requestbook +import json +from django.http import HttpResponse +import sys + +# Create your views here. + + +def shipInfo(request): + if request.method == 'GET': + today = datetime.date.today() + shipmentInfo = shipment.objects.all() + s = [] + for i in shipmentInfo: + s.append([i.shipmentID, 'From ' + i.leaveDate.__str__() + ' To ' + i.arriveDate.__str__()]) + + res = { + 'shipInfo': s, + 'status': '0' + } + + return HttpResponse(json.dumps(res), content_type="application/json") + + +def signIn(request): + if request.method == 'GET': + #print(request.get_full_path(), file=sys.stderr) + + passwordNow = request.GET['password'] + emailNow = request.GET['email'] + + #print(passwordNow, file=sys.stderr) + #print(emailNow, file=sys.stderr) + + check = user.objects.get(email=emailNow) + + if (check.password == passwordNow): + res = { + 'status': '0', + 'userid': check.userID, + 'usertype': check.userType + } + else: + res = { + 'status': '1' + } + return HttpResponse(json.dumps(res), content_type="application/json") + + +def signUp(request): + if request.method == 'POST': + req = json.loads(request.body.decode()) + + newUser = user() + newUser.email = req.get('email') + newUser.password = req.get('password') + newUser.userName = req.get('realname') + newUser.phoneNumber = req.get('phonenumber') + newUser.homeAddress = req.get('address') + + check = user.objects.filter(email=newUser.email) + + if (check): + res = { + 'status': 1, + 'msg':'email exist' + } + return HttpResponse(json.dumps(res), content_type="application/json") + + else: + newUser.save() + res = { + 'status': '0', + 'usertype': '0', + 'userid': newUser.userID, + 'msg': 'success' + } + return HttpResponse(json.dumps(res), content_type="application/json") + else: + res = { + 'status': '0', + 'msg': 'error access' + } + return HttpResponse(json.dumps(res), content_type="application/json") + + +def profile(request): + if request.method == 'GET': + useridNow = int(request.GET['userid']) + userNow = user.objects.get(userID=useridNow) + + if (userNow): + res = { + 'status': '0', + 'email': userNow.email, + 'password': userNow.password, + 'realname': userNow.userName, + 'phonenumber': userNow.phoneNumber, + 'address': userNow.homeAddress + } + return HttpResponse(json.dumps(res), content_type="application/json") + else: + res = { + 'status': '1', + 'msg': 'user not exist' + } + return HttpResponse(json.dumps(res), content_type="application/json") + + +def updateprofile(request): + if request.method == 'POST': + req = json.loads(request.body.decode()) + + useridNow = int(req.get('userid')) + userNow = user.objects.get(userID=useridNow) + + userNow.email = req.get('email') + userNow.password = req.get('password') + userNow.userName = req.get('realname') + userNow.phoneNumber = req.get('phonenumber') + userNow.homeAddress = req.get('address') + + userNow.save() + + res = { + 'status': '0', + 'msg': 'success' + } + return HttpResponse(json.dumps(res), content_type="application/json") + +def displaybook(request): + if request.method == 'GET': + useridNow = int(request.GET['userid']) + if (int(user.objects.get(userID=useridNow).userType) > 0): + booklist = requestbook.objects.all() + else: + booklist = requestbook.objects.filter(userID_id=useridNow) + + res = [] + + for i in booklist: + select = shipment.objects.get(shipmentID=int(i.shipmentID_id)) + str = 'From ' + select.leaveDate.__str__() + ' To ' + select.arriveDate.__str__() + + res.append({ + 'bookingNumber': i.bookID, + 'bookingStatus': i.status, + 'HBLNumber': i.HBL, + 'boxNumber': i.boxNumber, + 'destination': i.destination, + 'pickupAddress': i.pickup, + 'pickupDate': i.pickupDate.__str__().split(' ')[0], + 'selectDate': str, + 'optionalInformationCustomer': i.customerMessage, + 'optionalInformationShipper': i.shiperMessage, + 'cost': i.cost}) + + res = { + 'booklist': res, + 'status': '0' + } + return HttpResponse(json.dumps(res), content_type="application/json") + + +def newbook(request): + if request.method == 'POST': + req = json.loads(request.body.decode()) + newbook = requestbook() + + newbook.boxNumber = int(req.get('boxnumber')) + newbook.cost = newbook.boxNumber * 35 + newbook.shipmentID_id = int(req.get('shipmentid')) + newbook.userID_id = int(req.get('userid')) + newbook.destination = req.get('destination') + newbook.pickup = req.get('pickupaddress') + newbook.customerMessage = req.get('cutomermsg') + newbook.save() + + res = { + 'status': '0', + 'msg': 'success' + } + return HttpResponse(json.dumps(res), content_type="application/json") + + +def updatebook(request): + if request.method == 'POST': + req = json.loads(request.body.decode()) + + bookidNow = int(req.get('bookingNumber')) + bookCur = requestbook.objects.get(bookID=bookidNow) + + bookCur.HBL = req.get('bookingHBL') + print(bookCur.HBL, file=sys.stderr) + bookCur.status = req.get('bookingStatus', bookCur.status) + bookCur.pickupDate = req.get('bookingPickupDate', bookCur.pickupDate) + bookCur.shiperMessage = req.get('bookingInformationShipper', bookCur.shiperMessage) + + bookCur.save() + + res = { + 'status': '0', + 'msg': 'success' + } + return HttpResponse(json.dumps(res), content_type="application/json") + + + -- GitLab