Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
PMPBackend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lihuan Zhang
PMPBackend
Commits
cde968fc
Commit
cde968fc
authored
6 years ago
by
Lihuan Zhang
Browse files
Options
Downloads
Patches
Plain Diff
test1
parent
f4a74ab1
Branches
Branches containing commit
No related tags found
Loading
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
PMPBackend/settings.py
+10
-2
10 additions, 2 deletions
PMPBackend/settings.py
cargo/views.py
+15
-4
15 additions, 4 deletions
cargo/views.py
with
25 additions
and
6 deletions
PMPBackend/settings.py
+
10
−
2
View file @
cde968fc
...
...
@@ -79,9 +79,9 @@ DATABASES = {
# }
'
default
'
:
{
'
ENGINE
'
:
'
django.db.backends.mysql
'
,
'
NAME
'
:
'
lihuanz
'
,
'
NAME
'
:
'
pmpback
'
,
'
USER
'
:
'
lihuanz
'
,
'
HOST
'
:
'
info20003db.eng.unimelb.edu.au
'
,
'
HOST
'
:
'
127.0.0.1
'
,
'
PASSWORD
'
:
'
zlh2005zlh
'
,
'
PORT
'
:
3306
,
}
...
...
@@ -125,3 +125,11 @@ USE_TZ = True
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL
=
'
/static/
'
# Email
EMAIL_USE_SSL
=
True
EMAIL_HOST
=
'
smtp.gmail.com
'
# 如果是 163 改成 smtp.163.com
EMAIL_PORT
=
587
EMAIL_HOST_USER
=
'
susantoonlinecargo@gmail.com
'
# 帐号
EMAIL_HOST_PASSWORD
=
'
G27HLFeb8dIx
'
# 密码
DEFAULT_FROM_EMAIL
=
EMAIL_HOST_USER
This diff is collapsed.
Click to expand it.
cargo/views.py
+
15
−
4
View file @
cde968fc
#charset utf8
from
django.shortcuts
import
render
,
redirect
import
datetime
from
cargo.models
import
user
,
shipment
,
requestbook
from
django.core.mail
import
send_mail
import
json
from
django.http
import
HttpResponse
import
sys
...
...
@@ -11,7 +13,7 @@ import sys
def
shipInfo
(
request
):
if
request
.
method
==
'
GET
'
:
today
=
datetime
.
date
.
today
()
shipmentInfo
=
shipment
.
objects
.
all
()
shipmentInfo
=
shipment
.
objects
.
all
()
.
order_by
(
'
leaveDate
'
)
s
=
[]
for
i
in
shipmentInfo
:
s
.
append
([
i
.
shipmentID
,
'
From
'
+
i
.
leaveDate
.
__str__
()
+
'
To
'
+
i
.
arriveDate
.
__str__
()])
...
...
@@ -29,7 +31,7 @@ def signIn(request):
#print(request.get_full_path(), file=sys.stderr)
passwordNow
=
request
.
GET
[
'
password
'
]
emailNow
=
request
.
GET
[
'
email
'
]
emailNow
=
request
.
GET
[
'
email
'
]
.
__str__
().
replace
(
'
%40
'
,
'
@
'
)
#print(passwordNow, file=sys.stderr)
#print(emailNow, file=sys.stderr)
...
...
@@ -54,7 +56,7 @@ def signUp(request):
req
=
json
.
loads
(
request
.
body
.
decode
())
newUser
=
user
()
newUser
.
email
=
req
.
get
(
'
email
'
)
newUser
.
email
=
req
.
get
(
'
email
'
)
.
__str__
()
# + '@gmail.com'
newUser
.
password
=
req
.
get
(
'
password
'
)
newUser
.
userName
=
req
.
get
(
'
realname
'
)
newUser
.
phoneNumber
=
req
.
get
(
'
phonenumber
'
)
...
...
@@ -197,9 +199,18 @@ def updatebook(request):
bookCur
.
status
=
req
.
get
(
'
bookingStatus
'
,
bookCur
.
status
)
bookCur
.
pickupDate
=
req
.
get
(
'
bookingPickupDate
'
,
bookCur
.
pickupDate
)
bookCur
.
shiperMessage
=
req
.
get
(
'
bookingInformationShipper
'
,
bookCur
.
shiperMessage
)
userid
=
bookCur
.
userID
bookCur
.
save
()
userNow
=
user
.
objects
.
get
(
userID
=
userid
)
send_mail
(
'
You booking have been updated.
'
,
'
Hi
'
+
userNow
.
userName
+
'
,
\n
Your booking status have been changed, please check it.
'
,
'
susantoonlinecargo@gmail.com
'
,
[
userNow
.
email
.
__str__
()],
fail_silently
=
False
)
res
=
{
'
status
'
:
'
0
'
,
'
msg
'
:
'
success
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment