【发布时间】:2011-11-14 18:56:13
【问题描述】:
我是第一次与django-profiles 合作,所以我可能缺少一些基本的东西。
我想创建一个包含地理字段的 UserProfile 模型。具体来说是这样的:
class UserProfile(models.Model):
user = models.OneToOneField(User)
phone = PhoneNumberField()
address = models.CharField(max_length=200)
distance = models.IntegerField()
zone = models.ForeignKey(Hood, null=True, blank=True)
location = models.PointField(srid=900913, null=True, blank=True)
objects = models.GeoManager()
我正在从 contrib.gis.db 导入模型,并且还从 auth 导入通用用户模型。
当我尝试运行 syncdb 时,我收到以下错误:
AttributeError: 'module' object has no attribute 'PointField'
【问题讨论】:
-
from django.contrib.gis.db.models import PointField并使用它