On 13 jan 2006, at 13.15, Gábor Farkas wrote:
2. forms/manipulators: again, there are auto-created manipulators
for database-models, but for my needs there is need for a custom
one. yes, i can create a custom validator, but is that simpler than
to simply do all the validating by myself?
yesterday i decided that i will simply do all the validation by
myself, but today when writing the 3rd-level of an if-tree, i
started to wonder if maybe a custom validator would be simpler :)
I can't see any reason not to use custom validators for this. The add/
change-manipulatora and validators structure can take a lot of
validation code but will separate it out to be very clean. A simpler
system or writing you own might be faster but I'm doubtful it'll be
as clean and easy to follow if you add even an moderate amount of
validation. Have a look at the docs: http://www.djangoproject.com/
documentation/forms/#validators. Then also look into django/core/
validators.py for a lot of convenience validators, especially the
ones which validates between fields have been helpful to me.
hth,
- Daniel