Last active
March 17, 2017 00:45
-
-
Save hammadzz/5623b3ee89877a96b39307dd59ec15c3 to your computer and use it in GitHub Desktop.
Custom OSMGeoAdmin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.gis import admin | |
from django.contrib.gis.geos import Point | |
from .models import Location | |
class CustomGeoAdmin(admin.OSMGeoAdmin): | |
map_width = 800 | |
map_height = 500 | |
# Toronto | |
lon = -79.3832 | |
lat = 43.6532 | |
pnt = Point(lon, lat, srid=4326) | |
pnt.transform(3857) | |
default_lon, default_lat = pnt.coords | |
default_zoom = 10 | |
admin.site.register(Location, CustomGeoAdmin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment