Django-profiles,用户档案和Geo字段?

use*_*162 1 django-profiles geodjango

我是第一次使用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()
Run Code Online (Sandbox Code Playgroud)

我正在从contrib.gis.db导入模型,并从auth导入通用用户模型.

当我尝试运行syncdb时,我收到以下错误:

AttributeError: 'module' object has no attribute 'PointField'
Run Code Online (Sandbox Code Playgroud)

Ali*_*Ali 8

你应该将此行添加到models.py中,然后不要将任何内容作为模型导入.

来自django.contrib.gis.db导入模型