Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProjectClient_Y1S1_tramshedTech_team15
Manage
Activity
Members
Labels
Plan
Issues
7
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Arianne Bayliss
ProjectClient_Y1S1_tramshedTech_team15
Commits
4aa5d9b1
Commit
4aa5d9b1
authored
2 years ago
by
Liam Driscoll
Browse files
Options
Downloads
Patches
Plain Diff
Changes to search functionality.
parent
4a65e732
No related branches found
Branches containing commit
No related tags found
1 merge request
!43
Changes to search functionality.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
project_server.py
+19
-17
19 additions, 17 deletions
project_server.py
static/JS/Manage_Coworking_Spaces.js
+11
-0
11 additions, 0 deletions
static/JS/Manage_Coworking_Spaces.js
with
30 additions
and
17 deletions
project_server.py
+
19
−
17
View file @
4aa5d9b1
...
@@ -10,29 +10,31 @@ ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
...
@@ -10,29 +10,31 @@ ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
@app.route
(
"
/
"
,
methods
=
[
'
GET
'
])
@app.route
(
"
/
"
,
methods
=
[
'
GET
'
])
def
returnIndex
():
def
returnIndex
():
return
render_template
(
"
test.html
"
)
if
(
request
.
method
==
'
GET
'
):
return
render_template
(
"
test.html
"
)
@app.route
(
"
/Manage_Coworking_Spaces
"
,
methods
=
[
'
GET
'
])
@app.route
(
"
/Manage_Coworking_Spaces
"
,
methods
=
[
'
GET
'
])
def
returnManageCoworkingSpaces
():
def
returnManageCoworkingSpaces
():
return
render_template
(
"
Manage_Coworking_Spaces.html
"
)
if
(
request
.
method
==
'
GET
'
):
return
render_template
(
"
Manage_Coworking_Spaces.html
"
)
@app.route
(
"
/SearchRecord
"
,
methods
=
[
'
POST
'
])
@app.route
(
"
/SearchRecord
"
,
methods
=
[
'
POST
'
,
'
GET
'
])
def
searchRecord
():
def
searchRecord
():
if
request
.
method
==
'
POST
'
:
try
:
try
:
recordName
=
request
.
form
.
get
(
'
recordName
'
,
default
=
"
Error
"
)
recordName
=
request
.
form
.
get
(
'
recordName
'
,
default
=
"
Error
"
)
conn
=
sqlite3
.
connect
(
DATABASE
)
conn
=
sqlite3
.
connect
(
DATABASE
)
cur
=
conn
.
cursor
(
)
cur
=
conn
.
cursor
(
)
cur
.
execute
(
"
SELECT * FROM coworking_spaces WHERE Name=?;
"
,
[
recordName
]
)
cur
.
execute
(
"
SELECT * FROM coworking_spaces WHERE Name=?;
"
,
[
recordName
]
)
recordData
=
cur
.
fetchall
(
)
recordData
=
cur
.
fetchall
()
except
:
except
:
print
(
f
"
Error:
{
recordData
}
"
)
print
(
f
"
Error:
{
recordData
}
"
)
conn
.
close
()
conn
.
close
()
finally
:
finally
:
conn
.
close
()
conn
.
close
()
print
(
f
"
{
str
(
recordData
)
}
Record found.
"
)
print
(
f
"
{
recordData
}
Record found.
"
)
return
str
(
recordData
)
return
(
recordData
)
# Adds a record to the CSV file.
# Adds a record to the CSV file.
@app.route
(
"
/AddRecord
"
,
methods
=
[
'
POST
'
])
@app.route
(
"
/AddRecord
"
,
methods
=
[
'
POST
'
])
...
...
This diff is collapsed.
Click to expand it.
static/JS/Manage_Coworking_Spaces.js
+
11
−
0
View file @
4aa5d9b1
...
@@ -52,6 +52,17 @@ function searchRecord(e) {
...
@@ -52,6 +52,17 @@ function searchRecord(e) {
xhttp
.
onreadystatechange
=
function
()
{
xhttp
.
onreadystatechange
=
function
()
{
if
(
xhttp
.
readyState
===
4
&&
xhttp
.
status
===
200
)
{
if
(
xhttp
.
readyState
===
4
&&
xhttp
.
status
===
200
)
{
console
.
log
(
xhttp
.
responseText
);
console
.
log
(
xhttp
.
responseText
);
serverResponse
=
JSON
.
parse
(
xhttp
.
responseText
);
document
.
getElementById
(
"
recordName
"
).
value
=
serverResponse
[
0
][
0
];
document
.
getElementById
(
"
recordAddress
"
).
value
=
serverResponse
[
0
][
1
];
document
.
getElementById
(
"
recordMainPhotos
"
).
value
=
serverResponse
[
0
][
2
];
document
.
getElementById
(
"
recordAdditionalPhotos
"
).
value
=
serverResponse
[
0
][
3
];
document
.
getElementById
(
"
recordDescription
"
).
value
=
serverResponse
[
0
][
4
];
document
.
getElementById
(
"
recordWebsite
"
).
value
=
serverResponse
[
0
][
5
];
document
.
getElementById
(
"
recordEmail
"
).
value
=
serverResponse
[
0
][
6
];
document
.
getElementById
(
"
recordPhoneNumber
"
).
value
=
serverResponse
[
0
][
7
];
document
.
getElementById
(
"
recordOpeningHours
"
).
value
=
serverResponse
[
0
][
8
];
document
.
getElementById
(
"
recordCheckinInstructions
"
).
value
=
serverResponse
[
0
][
9
];
document
.
getElementById
(
"
DEBUGserverMessage
"
).
innerHTML
=
xhttp
.
responseText
;
document
.
getElementById
(
"
DEBUGserverMessage
"
).
innerHTML
=
xhttp
.
responseText
;
}
else
{
}
else
{
console
.
error
(
`Status Text:
${
xhttp
.
statusText
}
.`
);
console
.
error
(
`Status Text:
${
xhttp
.
statusText
}
.`
);
...
...
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