Commit 3d410741 authored by Michael R Lundquist's avatar Michael R Lundquist

Delete jsonToFixture.py

parent 34a3ec68
Pipeline #4763 passed with stage
in 1 minute and 4 seconds
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment