开发者

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

开发者 https://www.devze.com 2022-12-29 17:26 出处:网络
text_field = models.CharField(max_length=max) can I do this? I am using postgresql 8.4. 开发者_Python百科ThanksYou want to use the type TextField. Like this:

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

精彩评论

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