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
b398ff79
Commit
b398ff79
authored
2 years ago
by
Liam Driscoll
Browse files
Options
Downloads
Patches
Plain Diff
Search button functionality.
parent
69ab9bfc
No related branches found
No related tags found
1 merge request
!36
Search button functionality.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
project_server.py
+21
-0
21 additions, 0 deletions
project_server.py
static/JS/Manage_Coworking_Spaces.js
+1
-10
1 addition, 10 deletions
static/JS/Manage_Coworking_Spaces.js
with
22 additions
and
10 deletions
project_server.py
+
21
−
0
View file @
b398ff79
...
...
@@ -7,6 +7,27 @@ DATABASE = "project_db.db"
ALLOWED_EXTENSIONS
=
set
([
'
txt
'
,
'
pdf
'
,
'
png
'
,
'
jpg
'
,
'
jpeg
'
,
'
gif
'
])
@app.route
(
"
/SearchRecord
"
,
methods
=
[
'
POST
'
])
def
searchRecord
():
print
(
'
Processing search.
'
)
infoMessage
=
(
'
Record not found.
'
)
if
request
.
method
==
'
POST
'
:
recordName
=
request
.
form
.
get
(
'
recordName
'
,
default
=
"
Error
"
)
conn
=
sqlite3
.
connect
(
DATABASE
)
cur
=
conn
.
cursor
()
cur
.
execute
(
"
SELECT * FROM coworking_spaces WHERE Name=?;
"
,
[
recordName
])
recordData
=
cur
.
fetchall
()
conn
.
close
()
infoMessage
=
(
f
'
{
recordData
}
Record search.
'
)
return
str
(
recordData
)
print
(
infoMessage
)
return
(
infoMessage
)
# Adds a record to the CSV file.
@app.route
(
"
/AddRecord
"
,
methods
=
[
'
POST
'
])
def
addRecord
():
...
...
This diff is collapsed.
Click to expand it.
static/JS/Manage_Coworking_Spaces.js
+
1
−
10
View file @
b398ff79
...
...
@@ -42,18 +42,9 @@ function searchRecord(e) {
// Assigning form element values to variables.
var
recordName
=
document
.
getElementById
(
"
recordName
"
).
value
;
var
recordAddress
=
document
.
getElementById
(
"
recordAddress
"
).
value
;
var
recordMainPhotos
=
document
.
getElementById
(
"
recordMainPhotos
"
).
value
;
var
recordAdditionalPhotos
=
document
.
getElementById
(
"
recordAdditionalPhotos
"
).
value
;
var
recordDescription
=
document
.
getElementById
(
"
recordDescription
"
).
value
;
var
recordWebsite
=
document
.
getElementById
(
"
recordWebsite
"
).
value
;
var
recordEmail
=
document
.
getElementById
(
"
recordEmail
"
).
value
;
var
recordPhoneNumber
=
document
.
getElementById
(
"
recordPhoneNumber
"
).
value
;
var
recordOpeningHours
=
document
.
getElementById
(
"
recordOpeningHours
"
).
value
;
var
recordCheckinInstructions
=
document
.
getElementById
(
"
recordCheckinInstructions
"
).
value
;
// Creating a form data-type to transfer multiple parameters to the server.
var
params
=
'
recordName=
'
+
recordName
+
'
&recordAddress=
'
+
recordAddress
+
'
&recordMainPhotos=
'
+
recordMainPhotos
+
'
&recordAdditionalPhotos=
'
+
recordAdditionalPhotos
+
'
&recordDescription=
'
+
recordDescription
+
'
&recordWebsite=
'
+
recordWebsite
+
'
&recordEmail=
'
+
recordEmail
+
'
&recordPhoneNumber=
'
+
recordPhoneNumber
+
'
&recordOpeningHours=
'
+
recordOpeningHours
+
'
&recordCheckinInstructions=
'
+
recordCheckinInstructions
;
var
params
=
'
recordName=
'
+
recordName
;
var
xhttp
=
new
XMLHttpRequest
();
xhttp
.
open
(
"
POST
"
,
'
/SearchRecord
'
,
true
);
...
...
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