Hi Florian, Wim and all,

On Saturday 27 February 2016 16:56:25 Florian Apolloner wrote:
> 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 ;)
> 

I disagree.

> > 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?

Not really (see below).

> (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.
> 

I think this is why we should be a little more cautious and go for 128 or 100, 
rather than "the current maximum all-backend-compatible value".

> 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,

No, that's not the only difference. There's also an understanding that 
CharField's are one-liners, that is, there is an implicit limitation (usually 
only enforced by UI) that newlines are not allowed in the text.

And that makes it a different kind of beast, in general. For example, I don't 
think there are many CharField's whose contents are interpreted as markup. On 
the other hand, you don't see many TextField's with Regex validators. In a 
user perspective, these are really different data types. I find your suggestion 
analogous to a suggestion to remove IntegerField, because "it's just a 
FloatField with a constraint on scale".

My 2 cents,
        Shai.
      • ... 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
      • ... Aymeric Augustin

Reply via email to