Skip to content

Instantly share code, notes, and snippets.

@hammadzz
Last active March 17, 2017 00:45
Show Gist options
  • Save hammadzz/5623b3ee89877a96b39307dd59ec15c3 to your computer and use it in GitHub Desktop.
Save hammadzz/5623b3ee89877a96b39307dd59ec15c3 to your computer and use it in GitHub Desktop.
Custom OSMGeoAdmin
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