Stripping leading and trailing whitespace from text fields
in forms in
nearly always desirable, but Django doesn't handle this for
me.
There seems to be a hook built in for massaging input data
before it's
validated: FormField.prepare(). I tried subclassing
TextField like so:
class MyTextField(django.forms.TextField):
def prepare(self, new_data):
new_data = new_data.strip()
But since strings are passed by copy, this has no effect.
Any suggestions?
Do you think this functionality should be built into Django?
--~--~---------~--~----~------------~-------~--~----~
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
django-users-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---
|