开发者

How do I add a field in Django model whose data type is set to text

text_field = models.CharField(max_length=max) can I do this? I am using postgresql 8.4.

开发者_Python百科Thanks


You want to use the type TextField. Like this:

text_field = models.TextField()


What you have there should do the trick. What issues are you seeing?

class MyModel(models.Model):
    text = models.CharField(max_length=100)

If you're looking for a text blob, use:

text = models.TextField()
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜