Snippet List
This only works with Point geometry.
[video](http://www.youtube.com/watch?v=gZ7_n177sTE&list=HL1351725584&feature=mh_lolz)
Rename the snippet as gmgdav3.js and save it to template/admin with [gmgdav3.html](http://djangosnippets.org/snippets/2840/)
* - *models.py*:
` from django.contrib.gis.db import models`
` class point(models.Model):`
` address = models.CharField(max_length=100, help_text='Press "Tab" to refresh the map')`
` longitude = models.FloatField(help_text='WGS84 Decimal Degree. Press "Tab" to refresh the map')`
` latitude = models.FloatField(help_text='WGS84 Decimal Degree. Press "Tab" to refresh the map')`
` in_geom = models.PointField('shp', srid=4326)`
` objects = models.GeoManager()`
` def __unicode__(self):`
` return str(self.address)`
* - *admin.py*:
` from models import * `
` from django.conf import settings`
` from django.contrib.gis import admin`
` from django.contrib.gis.geos import GEOSGeometry`
` class GoogleAdmin(admin.OSMGeoAdmin):`
` g = GEOSGeometry('POINT (9.191884 45.464254)') # Set map center`
` g.set_srid(4326)`
` g.transform(900913)`
` default_lon = int(g.x)`
` default_lat = int(g.y)`
` default_zoom = 7`
` extra_js = ["http://maps.google.com/maps/api/js?v=3.2&sensor=false"]`
` map_template = 'gmgdav3.html'`
` admin.site.register(point, GoogleAdmin)`
` # admin.site.register(your other models...,...)`
- admin
- google-maps
- geocode
- geolocation
- geodjango
CitySelector is a jquery widget, allowing to pick cities from DB, filled by django_ipgeobase application.
Also it includes widget for django forms, based on mentioned jquery plugin, views and urlconf, required to provide
interaction between widget and DB and middleware, populating request with correspondent location.
Visit https://bitbucket.org/JustDelight/city_selector
- jquery
- widget
- geolocation
- jqueryui
- ru
- django_ipgeobase
The WorldIP database provides real-world geographical location. Database is more correct than [Whois records and Whois-based databases](http://www.wipmania.com/en/blog/why-worldip-data-rather-than-whois-data-examples/), that show geographic locations of network owners, and not the geographic location of Internet-connected PC or appliance itself.
See more: [WIPmania.com](http://www.wipmania.com)
- ip
- geolocation
- geodjango
- worldip
Use this script to import the Maxmind GeoIP lite CSV datasets into your database. This takes at least 200MB of RAM; the resulting database will be ~400MB. Stick in the same directory as the [models](http://www.djangosnippets.org/snippets/327/). Make sure to set `DEBUG=False` to prevent running out of memory during import.
- log
- csv
- gis
- ip
- geolocation
- maxmind
- geodjango
- import
This provides GeoDjango models for the maxmind GeoIP Lite data products. Use the corresponding [CSV import script](http://www.djangosnippets.org/snippets/328/) for data import. Requires: [GeoDjango](http://code.djangoproject.com/wiki/GeoDjango) and the [BigIntegerField patch](http://code.djangoproject.com/attachment/ticket/399/django-bigint-20070712.patch) by Peter Nixon.
- log
- gis
- ip
- geolocation
- maxmind
- geodjango
5 snippets posted so far.