Karen Tracey wrote: > On Fri, Jul 4, 2008 at 3:51 AM, Greg Fuller <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > I want to mention what I consider to be a usability issue with Django > forms. It has to do with there being no option to strip leading and > trailing whitespace from CharFields, URLFields, EmailFields, etc. > Ticket #4969 was to address this issue but was closed with as a > 'wontfix', and I have seen other discussions on this issue. > > > I think you mean #4960 (http://code.djangoproject.com/ticket/4960), not > #4969. There is also another ticket opened for this, #6362 > (http://code.djangoproject.com/ticket/6362) which is in design decision > needed. > > I agree that an option to strip leading/trailing wihtespace from form > fields would be useful, and is probably more often than not the behavior > that is desired by default. > > Karen
It's easier and quicker to locally extend Django. Here's the start of my forms extension. It has all the form goodness I want and in my forms.py I do a from myforms import * from django import newforms as forms from django.newforms import ModelForm from django.newforms.models import ModelChoiceField, ModelMultipleChoiceField from django.contrib.localflavor.us.forms import USPhoneNumberField from django.newforms.fields import * from django.newforms.widgets import * import django.newforms.fields import django.newforms.widgets __all__ = ["StrippedCharField",] __all__.extend(["forms", "ModelForm", "ModelChoiceField", "ModelMultipleChoiceField", "USPhoneNumberField"]) __all__.extend(django.newforms.fields.__all__) __all__.extend(django.newforms.widgets.__all__) class StrippedCharField(CharField): """Newforms CharField that strips trailing and leading spaces.""" def clean(self, value): if value is not None: value = value.strip() return super(StrippedCharField, self).clean(value) -- Norman J. Harman Jr. Senior Web Specialist, Austin American-Statesman ___________________________________________________________________________ You've got fun! Check out Austin360.com for all the entertainment info you need to live it up in the big city! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---