Skip to content

Commit 653c273

Browse files
author
scotty
committed
new user can be added now
1 parent 82f65c9 commit 653c273

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

app.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from flask import Flask, request, render_template, redirect
2-
import json, time
2+
import json, datetime
33
from flask.ext.sqlalchemy import SQLAlchemy
4-
from models import gsm, tracker,app
4+
from models import gsm, tracker,app,db
55

66
@app.route('/query', methods=['POST'])
77
def query():
@@ -12,6 +12,14 @@ def query():
1212
peoplelist.append(elem.idtype + ": " +str(elem.id))
1313
return json.dumps(peoplelist)
1414

15+
@app.route('/add', methods=['POST'])
16+
def new():
17+
data = request.form['data']
18+
data = json.loads(data)
19+
a = gsm(data['id'],4444,datatime.datetime.now(),200,data['method'],data['name'],data['dob'],data['e-number'])
20+
db.session.add(a)
21+
db,session.commit()
22+
#name, dob, e-name, e-number, cond, medicines, id, method
1523
@app.route('/')
1624
def index():
1725
trackers = tracker.query.all()

templates/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@
5151
});
5252
});
5353
}
54+
google.maps.event.addListener(map, 'dblclick', function(event) {
55+
mapZoom = map.getZoom();
56+
startLocation = event.latLng;
57+
alert(startLocation);
58+
marker=new google.maps.Marker({
59+
position:startLocation,
60+
icon: "{{ url_for('static', filename='images/comics.png') }}",
61+
animation:google.maps.Animation.BOUNCE
62+
});
63+
64+
marker.setMap(map);
65+
});
66+
5467
}
5568
google.maps.event.addDomListener(window, 'load', initialize);
5669
</script>

0 commit comments

Comments
 (0)