Login

Tag "strings"

Snippet List

Automatically trim newforms text fields

Makes sure the value a user entered into a a text-based field is automatically trimmed during form cleaning / validation. The 'field' parameter is expected to be a newforms.fields.Field _instance_.Only modifies str and unicode descending values, and passes everything else on untouched. Example: form = form_for_model(Person) make_trimming(form.fields['name'])

  • newforms
  • strings
  • trim
Read More

1 snippet posted so far.