Skip to content

Instantly share code, notes, and snippets.

View kwilcox's full-sized avatar
🎯
ABC

Kyle Wilcox kwilcox

🎯
ABC
View GitHub Profile
@kwilcox
kwilcox / flask_admin.py
Last active June 20, 2019 13:42
WTForms and GeoAlchemy2
from flask.ext.admin.contrib.sqla import ModelView
# 'location' is the GeoAlchemy2 column
class FeatureView(ModelView):
...
form_overrides = dict(location=WTFormsMapField)
form_args = dict(
location=dict(
geometry_type='Polygon', height=500, width=500, cloudmade_api="{your_api}"
)
@akhenakh
akhenakh / tools.py
Created June 19, 2012 14:47
flask jsonify with support for MongoDB from tools import jsonify
try:
import simplejson as json
except ImportError:
try:
import json
except ImportError:
raise ImportError
import datetime
from bson.objectid import ObjectId
from werkzeug import Response