Hi Wim,

On Saturday, February 27, 2016 at 2:33:27 PM UTC+1, Wim Feijen wrote:
>
> Can you please elaborate why the current situation is better? 
>

I wouldn't say it is better, just equally good/bad ;)
 

> In practice, most people add max_length=255 everytime by hand. I value 
> your opinion but I fail to understand your reasoning. Could you please 
> explain further (if you have time)?  
>

In practice, that would mean most people do not care about the length, so 
they should be using a TextField, no? (See next paragraph for even another 
option) If you want something which works on multiple databases, 255 is a 
nonsensical default anyways -- with all the love for emojis out there, 
you'd be limiting yourself to 191 (thank MySQL for that 767/4 = 191). What 
worries me even more, is that changing this "default" (to accommodate for a 
new database for instance) will require database migrations, so all of a 
sudden upgrading django will result in migrations for all of your apps.

That all said, if it were for me I'd deprecate CharField and only support 
TextField and give it an optional max_length (and a way to switch between 
TextArea and LineEdit for UI) -- but that is probably just because on 
Postgres there is no fundamental difference between them. From an enduser 
perspective, it is all text, the only difference is a constraint in length, 
which does not explain the naming of this fields very well anyways (unless 
you are coming from a SQL background where you might be used to that 
distinction). As for the UI issues: A TextField with an optional max_length 
could use a <input> as default if max_length is specified and <textarea> 
otherwise (with a boolean flag to switch that too). Sadly, if we switch 
from max_length=None to max_length=xxx, this would mean an alteration of 
the database type on most databases, I am not sure if Django can handle 
that currently.

I hope this clears it up a little bit,
Florian

-- 
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/0239cd7a-ca2a-43eb-976c-3d8adf5e456a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
      • ... 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
      • ... Luke Plant
      • ... Josh Smeaton

Reply via email to