如何在django admin中自动启用MultiPolygonField和PointField

时间:2014-01-03 05:57:35

标签: python django django-admin geodjango

我是geodjango的新手,是否有任何方法或方法可以自动在django admin中创建MultiPolygonField和PointField。

我的模型如下:

from django.db import models
from django.contrib import admin
from django.contrib.gis.db import models
from django.contrib.gis import admin
# Create your models here.
class Country(models.Model):
    name = models.CharField('Country Name', max_length=200)
    lon = models.FloatField()
    lat = models.FloatField()
    mpoly = models.MultiPolygonField(default='SRID=3857;POINT(0.0 0.0)')
    geometry = models.PointField(srid=4326,default='SRID=3857;POINT(0.0 0.0)')
    objects = models.GeoManager()

    def __unicode__(self):
        return self.name

admin.site.register(Country,admin.GeoModelAdmin)

请帮帮我。

0 个答案:

没有答案