开发者

django 'module' object has no attribute 'StringProperty'

I'm just starting... I'm trying to use Django models but I'm getting the:

AttributeError: 'module' object has no attribute 'StringProperty'

Can you p开发者_JAVA技巧lease tell where can be the issue?

from django.db import models

# Create your models here.
class Test(models.Model):
    text = models.StringProperty()
    date = models.DateTimeProperty()

Thank you!


Your problem is you've got some bogus model field types. Here are the correct ones for django (read about them and other available field types in the django model field reference docs)

from django.db import models

# Create your models here.
class Test(models.Model):
    text = models.CharField(max_length=255)
    date = models.DateTimeField()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜