NewForms is one of my favorite feature in Django, and I am getting addicted to it. The first thing that comes our mind on the newforms' usage is for adding or updating records. Being a newforms addict, I also use it for doing search and even for forms that has one input element (not including the input type = submit)
When doing search, i need the inputs to be validate and that's easy with newforms. Just choose appropriate field if the input needs to be a number, a date, and etc. I am really happy with what MultipleChoiceField provide to make my search more flexible.
Item.objects.filter(status__in=form.cleaned_data['status'])
Sometimes a simple form as having a one input element needs a complicated validation. With newforms you can do almost do anything you can with python. It's every extensible and I'll try to show you on my next post.
Monday, January 7, 2008
Addicted to Django's NewForms
Posted by james_027 at 11:06 AM 157 comments
Subscribe to:
Posts (Atom)