Hi, > why isn't whitespace automatically stripped from fields when using > modelforms? This would be convenient.
It may be convenient for many cases but for many others that approach would *lose* information irrecoverably. What if you wanted to have some fields stored with their whitespace preserved? Say a Textarea field where a sentence typed in with a line break at the end needs to be interpreted differently than one without. For example, if you needed to use Markdown on such a field, then 2 spaces followed by a line break causes a <br/> to be generated by Markdown. Stripping such a field would cause a problem there. > Is there a reason for not doing so, where is one supposed to do that? - Add clean_<FIELD> methods to the modelform class and strip() fields there (or in the general clean() method.) - You can also override save() on your models and strip() out relevant fields before the data gets saved. -Rajesh Dhawan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---