On 2015-09-22 07:49, Aymeric Augustin wrote:
> > And for your concern, there will be a MaxLengthValidator added to
> > the validators to validate the users input does not exceed the
> > database backends maximum length just like when you set
> > max_length explicitly.
> 
> This isn’t possible in a project that uses multiple databases, say
> PostgreSQL and Oracle. The form layer cannot say which length is
> correct because it has doesn’t know in what database the data will
> be saved.

Could this be resolved with allowing max_length=None (or some other
atom such as just object() that would have a unique id() that could
be tested with "is") to specify that the back-end uses the max-allowed
value? For Postgres, this would then use VARCHAR() with no limit,
while on MySQL, that could be 255 or whatever.

One could then include a helper function that would use the current
settings to check a string (such as from a form) to ensure that it
doesn't exceed the field's database-specific max-length (or whatever
the specified max-length value is).

-tim




-- 
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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/20150922065843.37699cb6%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.
      • ... Christophe Pettus
      • ... Podrigal, Aron
      • ... Josh Smeaton
      • ... Aymeric Augustin
      • ... Collin Anderson
      • ... Michael Manfre
      • ... 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

Reply via email to