Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open
Commits
3d410741
Commit
3d410741
authored
Sep 18, 2019
by
Michael R Lundquist
Browse files
Delete jsonToFixture.py
parent
34a3ec68
Pipeline
#4763
passed with stage
in 1 minute and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
whats-open/api/fixtures/jsonToFixture.py
deleted
100644 → 0
View file @
34a3ec68
import
json
print
(
"HI"
)
with
open
(
'./openTimes.json'
)
as
f
:
x
=
json
.
loads
(
f
.
read
())
"""Yes, this file is totally unnecessary but I didn't have access to the dumpdata command so I did this."""
newList
=
list
()
open_times
=
list
()
for
i
in
x
:
nextSet
=
{
"pk"
:
None
,
"model"
:
"api.OpenTime"
,
"fields"
:
i
}
#{ "model":"api.category", "pk": i[1]["id"], "fields":{ "name": i[1]["name"] } }
newList
.
append
(
nextSet
)
"""
#For schedules
cpy = dict(i)
open_times += list( i["open_times"] )
del( cpy["id"] )
del( cpy["open_times"] )
nextSet = {
"pk": i["id"],
"model": "api.schedule",
"fields": cpy
}
#{ "model":"api.category", "pk": i[1]["id"], "fields":{ "name": i[1]["name"] } }
newList.append(nextSet)
"""
"""
#for categories
nextSet = { "model":"api.category", "pk": i[1]["id"], "fields":{ "name": i[1]["name"] } }
#for buildings
"""
"""
#FOR LOCATION
coords = i["coordinate_location"]["coordinates"]
nextSet = {
"fields": {
"building": i["building"],
"friendly_building": i["friendly_building"],
"address": i["address"],
"campus_region": i["campus_region"],
"coordinate_location":"SRID=4326;POINT (" + str(coords[0]) + " " + str(coords[1]) + ")" ,"on_campus":i["on_campus"],
},
"model": "api.location",
"pk": i["id"] }
"""
with
open
(
"./fixtureOut.json"
,
"w"
)
as
f
:
json
.
dump
(
newList
,
f
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment