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
71ce702d
Commit
71ce702d
authored
2 years ago
by
Liam Driscoll
Browse files
Options
Downloads
Patches
Plain Diff
Replacing .csv code with more appropriate database code.
parent
af6cd221
No related branches found
No related tags found
1 merge request
!28
Changes to CSS.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
project_server.py
+8
-5
8 additions, 5 deletions
project_server.py
static/Manage_Coworking_Spaces.js
+0
-1
0 additions, 1 deletion
static/Manage_Coworking_Spaces.js
with
8 additions
and
6 deletions
project_server.py
+
8
−
5
View file @
71ce702d
import
os
import
csv
import
sqlite3
from
flask
import
Flask
,
redirect
,
request
,
render_template
,
jsonify
app
=
Flask
(
__name__
)
DATABASE
=
"
project_db.db
"
ALLOWED_EXTENSIONS
=
set
([
'
txt
'
,
'
pdf
'
,
'
png
'
,
'
jpg
'
,
'
jpeg
'
,
'
gif
'
])
...
...
@@ -26,10 +27,12 @@ def addRecord():
recordCheckinInstructions
=
request
.
form
[
'
recordCheckinInstructions
'
]
recordData
=
[
recordName
,
recordAddress
,
recordMainPhotos
,
recordAdditionalPhotos
,
recordDescription
,
recordWebsite
,
recordEmail
,
recordPhoneNumber
,
recordOpeningHours
,
recordCheckinInstructions
]
with
open
(
'
coworking_spaces.csv
'
,
'
a
'
)
as
addToFile
:
csvWriter
=
csv
.
writer
(
addToFile
)
csvWriter
.
writerow
(
recordData
)
addToFile
.
close
()
conn
=
sqlite3
.
connect
(
DATABASE
)
cur
=
conn
.
cursor
()
cur
.
execute
(
"
INSERT INTO coworking_spaces (
'
Name
'
,
'
Address
'
,
'
Main_Photo
'
,
'
Additional_Photos
'
,
'
Description
'
,
'
Website
'
,
'
Email
'
,
'
Phone_Number
'
,
'
Opening_Hours
'
,
'
Checkin_Instructions
'
)
\
VALUES (?,?,?,?,?,?,?,?,?,?)
"
,
(
recordName
,
recordAddress
,
recordMainPhotos
,
recordAdditionalPhotos
,
recordDescription
,
recordWebsite
,
recordEmail
,
recordPhoneNumber
,
recordOpeningHours
,
recordCheckinInstructions
))
conn
.
commit
()
conn
.
close
()
infoMessage
=
(
f
'
{
recordData
}
Record added.
'
)
...
...
This diff is collapsed.
Click to expand it.
static/Manage_Coworking_Spaces.js
+
0
−
1
View file @
71ce702d
...
...
@@ -3,7 +3,6 @@ function onSubmitLoad() {
document
.
getElementById
(
'
addButton
'
).
addEventListener
(
'
click
'
,
addRecord
);
}
function
headerLoad
()
{
let
headerDiv
=
document
.
querySelector
(
'
#headerDiv
'
);
let
headerDivHeight
=
headerDiv
.
offsetHeight
;
...
...
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