My model has a SlugField. When I try to save an instance of this model with the slug field set to a string which is longer than the field's max_length
parameter (which is 50 by default), I get the following error from Postgresql: value too long for type character varying(50)
.
Is not Django (or Postgresql) supposed to truncate the string when saving? What can I do to fix it other than truncating it manually every time?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…