Adrian Holovaty wrote:
> Hey Gary, > > Great suggestion! Based on your idea, I've just checked in an extra > hook, Field.widget_attrs(), which lets a Field specify any HTML > attributes to add to its Widget. I've implemented the maxlength > attribute for CharField, so your example can be rewritten like this: > > name = CharField(max_length=64, required=True) That's better. Thanks. > As Honza pointed out, you can use ComboField to combine validators > from multiple fields. Alternatively, you can create your own Field > subclass. I realize this is slightly more work than just specifying a > validator_list -- do you think it's OK? Well, obviously it works, but ultimately I will have dozens of forms (mostly custom) each with its own validation rules for the most part. We are talking simply passing a parameter to choose from a stock list of validators or writing code to subclass (potentially) lots of filelds or mess about with ComboFields. I would take the simplest option if possible! I'm not usually wanting to combine validators for multiple fields, but more to apply multiple validators to each field. For example I may want to check that a field is an integer and it has a maximum value of 23. On another form I may want to check that it is an integer and has a max value of 42. Trivial examples I know, but all solvable by just supplying a validator list to each field. Your thoughts? Thanks, Gary. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers?hl=en -~----------~----~----~----~------~----~------~--~---