Explorar el Código

Merge branch 'master' of gitea:christian/bloomhunt

master
christian hace 6 años
padre
commit
72d9888633
Se han modificado 2 ficheros con 5 adiciones y 5 borrados
  1. +2
    -2
      map/views.py
  2. +3
    -3
      mobile/views.py

+ 2
- 2
map/views.py Ver fichero

@@ -5,10 +5,10 @@ import os




def index(request): def index(request):
if not os.path.isfile("/tmp/data.json"):
if not os.path.isfile("/home/areion/tmp/data.json"):
data = {"trees": str({ "trees": []}) } data = {"trees": str({ "trees": []}) }
else: else:
with open("/tmp/data.json", "r") as f:
with open("/home/areion/tmp/data.json", "r") as f:
loaded = json.load(f) loaded = json.load(f)
s = json.dumps(loaded); s = json.dumps(loaded);
data = {"trees": s} data = {"trees": s}


+ 3
- 3
mobile/views.py Ver fichero

@@ -54,13 +54,13 @@ def addtree(request):
longitude = request.POST["longitude"] longitude = request.POST["longitude"]
latitude = request.POST["latitude"] latitude = request.POST["latitude"]
bloom_start = datetime.now().timetuple().tm_yday bloom_start = datetime.now().timetuple().tm_yday
if not os.path.isfile('/tmp/data.json'):
if not os.path.isfile('/home/areion/tmp/data.json'):
data = {'trees': []} data = {'trees': []}
else: else:
with open('/tmp/data.json', 'r') as f:
with open('/home/areion/tmp/data.json', 'r') as f:
data = json.load(f) data = json.load(f)


with open('/tmp/data.json', 'w') as f:
with open('/home/areion/tmp/data.json', 'w+') as f:
data["trees"].append( data["trees"].append(
{'name': name, 'species': tree, {'name': name, 'species': tree,
'longitude': longitude, 'latitude': latitude, 'longitude': longitude, 'latitude': latitude,


Cargando…
Cancelar
Guardar