Hi guys, I'd like to reach consensus about https://code.djangoproject.com/ticket/14094
In the discussion, I saw three options: 1. Adding a default max_length = None, which may in practice differ per database backend. 2. Adding a default max_length of a value which can be used across databases. Lengths which have been mentioned are: 100, 128, 191 and 255 characters and 4000 bytes. 3. Keep everything as is, being as explicit as possible. Option 1 does not allow for apps and data to be reused across several apps and several core developers do not support this idea. I'm in favour of option 2, because it makes for shorter code and more importantly, it helps programmers choose a value which actually can be reused across multiple databases (I didn't know about the possible limit of 191 characters on mysql! Did you?). I dislike how it is now (option 3), and I don't think it is beneficial here to force people to be explicit, because people are now using arbitrary values anyway. 255 is commonly used, the poll app of the Django tutorial uses 200. Actually I believe it is a big mess in practice, I see defaults of 100, 200, 255, 300, 1000 seemingly randomly used. For example, try searching for CharField in your favourite apps or CMSes. In addition, adding a default for max_length still allows to be explicit when it matters. And it makes life simple when it doesn't matter, and simple is better than complex. What would be a good default then? I am in favour of making it as big as possible while still working on all databases, which would either be 191 of 255 in order to support mysql. Wim On Wednesday, 23 September 2015 19:02:20 UTC+2, Tom Christie wrote: > > I'm with Tom here. > Forcing `max_length` to always be set on CharField feels like the right > decision. Having a default there seems unnecessary obscure, and more likely > to lead to untested/unnoticed failure cases. > It *could* be that we'd allow `max_length=None` to explicitly turn off the > validation, but I'm not sure if that's better than forcing developers who > want unvalidated lengths to use TextField. > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a2cfad14-4384-4118-bc28-d89099433ca5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
