-1 on adding an arbitrary default like 100/128… If people choose a 
CharField the should set max_length manually. In that sense I am for option 
3.

Cheers,
Florian

On Saturday, February 27, 2016 at 1:55:23 PM UTC+1, Wim Feijen wrote:
>
> 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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/db2345be-ccf9-4305-be60-35c2a1434432%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
      • ... Aymeric Augustin
      • ... Podrigal, Aron
      • ... Aymeric Augustin
      • ... Podrigal, Aron
      • ... Tim Chase
      • ... 'Tom Evans' via Django developers (Contributions to Django itself)
  • Re: Ma... Remco Gerlich
    • R... Christophe Pettus
      • ... Tom Christie
      • ... Wim Feijen
      • ... Florian Apolloner
      • ... Wim Feijen
      • ... Florian Apolloner
      • ... Shai Berger
      • ... Florian Apolloner
      • ... Shai Berger
      • ... Luke Plant
      • ... Florian Apolloner
      • ... Loïc Bistuer
      • ... Florian Apolloner
      • ... Loïc Bistuer

Reply via email to