2016-11-05 18:35:58 +08:00
|
|
|
from django.contrib.gis.db import models
|
2012-08-12 18:32:08 +08:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2011-09-10 11:04:30 +08:00
|
|
|
|
2015-04-05 00:09:46 +08:00
|
|
|
from ..admin import admin
|
|
|
|
|
2013-11-03 04:12:09 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2011-09-10 11:04:30 +08:00
|
|
|
class City(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
point = models.PointField()
|
2014-01-01 18:01:46 +08:00
|
|
|
|
2015-03-21 23:59:30 +08:00
|
|
|
class Meta:
|
|
|
|
app_label = 'geoadmin'
|
2015-04-05 00:09:46 +08:00
|
|
|
required_db_features = ['gis_enabled']
|
2015-03-21 23:59:30 +08:00
|
|
|
|
2013-10-17 16:17:41 +08:00
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
2011-09-10 11:04:30 +08:00
|
|
|
|
2015-12-04 18:37:39 +08:00
|
|
|
|
2015-03-31 00:33:26 +08:00
|
|
|
site = admin.AdminSite(name='admin_gis')
|
2015-12-04 18:37:39 +08:00
|
|
|
site.register(City, admin.OSMGeoAdmin)
|