On Fri, Oct 24, 2008 at 11:26 AM, omat <[EMAIL PROTECTED]> wrote:

>
> Thanks for the reply Karen.
>
> Accepted but not used? Neither in the model nor in the forms? This is
> not how I would expect it to be.


Yes, that's the way it is.  max_length is specified as a possible keyword
argument in django.db.models.fields.Field.__init__ and there is no code in
any of the Field subclasses which don't use it (that I see) to object to its
unexpected/unused presence.  So you can specify max_length on a DateField,
e.g., and it's not an error.  It's just not used for anything.  This is
maybe a bit surprising but I don't know that it's worth "fixing".


>
> Then, how can I limit a, say comment field to 500 chars in a djangoic
> way?
>

Use a CharField with max_length 500 and override the widget used in your
forms, since a single-line input for something that large is pretty
obnoxious.

Or write your own limited text field that enforces a max_length, either at
the model field level or just at the forms level.

(Or rethink the idea of artificially limiting such things.)

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to