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
fc0751cb
Commit
fc0751cb
authored
2 years ago
by
Liam Driscoll
Browse files
Options
Downloads
Patches
Plain Diff
Adding locations and template route.
parent
a6f51012
No related branches found
Branches containing commit
No related tags found
1 merge request
!51
Adding locations and template route.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
project_server.py
+37
-2
37 additions, 2 deletions
project_server.py
templates/ListLocations.html
+26
-0
26 additions, 0 deletions
templates/ListLocations.html
with
63 additions
and
2 deletions
project_server.py
+
37
−
2
View file @
fc0751cb
import
os
import
os
import
sqlite3
import
sqlite3
from
flask
import
Flask
,
redirect
,
request
,
render_template
,
jsonify
from
flask
import
Flask
,
redirect
,
request
,
render_template
,
jsonify
,
url_for
,
flash
,
session
app
=
Flask
(
__name__
)
app
=
Flask
(
__name__
)
DATABASE
=
"
project_db.db
"
DATABASE
=
"
project_db.db
"
app
.
secret_key
=
"
hello
"
ALLOWED_EXTENSIONS
=
set
([
'
txt
'
,
'
pdf
'
,
'
png
'
,
'
jpg
'
,
'
jpeg
'
,
'
gif
'
])
ALLOWED_EXTENSIONS
=
set
([
'
txt
'
,
'
pdf
'
,
'
png
'
,
'
jpg
'
,
'
jpeg
'
,
'
gif
'
])
...
@@ -27,6 +28,16 @@ def returnManageCoworkingSpaces():
...
@@ -27,6 +28,16 @@ def returnManageCoworkingSpaces():
if
(
request
.
method
==
'
GET
'
):
if
(
request
.
method
==
'
GET
'
):
return
render_template
(
"
Manage_Coworking_Spaces.html
"
)
return
render_template
(
"
Manage_Coworking_Spaces.html
"
)
@app.route
(
"
/ListLocations
"
,
methods
=
[
'
GET
'
])
def
returnListLocations
():
if
(
request
.
method
==
'
GET
'
):
conn
=
connect_db
()
cur
=
conn
.
cursor
()
cur
.
execute
(
"
SELECT Name, Main_Photo FROM coworking_spaces
"
)
locationData
=
cur
.
fetchall
()
conn
.
close
()
return
render_template
(
"
ListLocations.html
"
,
data
=
locationData
)
@app.route
(
"
/Load/CodeBase
"
)
@app.route
(
"
/Load/CodeBase
"
)
def
Load
():
def
Load
():
Name
=
"
Codebase
"
;
Name
=
"
Codebase
"
;
...
@@ -59,7 +70,6 @@ def Load():
...
@@ -59,7 +70,6 @@ def Load():
return
render_template
(
'
Space.html
'
,
data
=
data
)
return
render_template
(
'
Space.html
'
,
data
=
data
)
# pageAddress = Address, pageMain_Photo = Main_Photo, pageAdditional_photos = Additional_photos, pageDescription = Description, pageWebsite = Website, pageOpening_Hours = Opening_Hours )
# pageAddress = Address, pageMain_Photo = Main_Photo, pageAdditional_photos = Additional_photos, pageDescription = Description, pageWebsite = Website, pageOpening_Hours = Opening_Hours )
@app.route
(
"
/SearchRecord
"
,
methods
=
[
'
POST
'
,
'
GET
'
])
@app.route
(
"
/SearchRecord
"
,
methods
=
[
'
POST
'
,
'
GET
'
])
def
searchRecord
():
def
searchRecord
():
...
@@ -177,5 +187,30 @@ def updateRecord():
...
@@ -177,5 +187,30 @@ def updateRecord():
print
(
infoMessage
)
print
(
infoMessage
)
return
(
infoMessage
)
return
(
infoMessage
)
@app.route
(
"
/locations
"
,
methods
=
[
"
POST
"
,
"
GET
"
])
def
Locations
():
print
(
'
Processing location
'
)
if
request
.
method
==
"
POST
"
:
session
.
permanent
=
True
locationsName
=
request
.
form
[
'
name
'
]
locationPic
=
request
.
form
[
'
image
'
]
conn
=
sqlite3
.
connect
(
DATABASE
)
cur
=
conn
.
cursor
()
cur
.
execute
(
"
SELECT Name, Main_photo FROM coworking_spaces WHERE Name= ?;
"
,
[
locationsName
])
conn
.
commit
()
conn
.
close
()
msg
=
"
Location added successfuly!
"
return
render_template
(
'
locations.html
'
)
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
app
.
run
(
debug
=
True
)
app
.
run
(
debug
=
True
)
This diff is collapsed.
Click to expand it.
templates/ListLocations.html
0 → 100644
+
26
−
0
View file @
fc0751cb
{%extends "base_template.html"%}
{%block headblock%}
<title>
Locations
</title>
{%endblock%}
{%block headerblock%}
<a
id=
"headerText"
href=
"ListLocations"
>
Locations
</a>
{%endblock%}
{%block mainblock%}
<br><br>
{%if data%}
{%for x in range(data|length)%}
{{data[x][0]}}
{{data[x][1]}}
<br><br>
{%endfor%}
{%endif%}
{%endblock%}
{%block jsblock%}
{%endblock%}
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