DatabaseError: value too long for type character varying(100)

后端 未结 11 452
北恋
北恋 2021-01-31 02:37

I have a Django web site running a mini CMS we\'ve built internally years ago, it\'s using postgresql. When saving a simple title and a paragraph of text I get the following err

11条回答
  •  闹比i
    闹比i (楼主)
    2021-01-31 03:07

    I had a similar problem with django-autoslugfield I was using a similar package and then switched over to django-autoslugfield

    I was getting this error: value too long for type character varying(50)

    despite the fact that my models.py had:

    slug = AutoSlugField(max_length=255, populate_from='name', unique=True)

    and in my db the it the type was character varying 255

    once i remove max_length=255 from the field i.e.

    slug = AutoSlugField(populate_from='name', unique=True)

    then it worked fine

提交回复
热议问题