Recently I’ve read a book jQuery: Novice to Ninja. I was using jQuery for a long time, however I felt that I was using only a small part of this library, so I decided to read some books about it. The books is rather good and easy (and interesting) to read. Here I want to [...]
I don’t know why this is not done by default, but.. from django import forms class TrimmedCharField(forms.CharField): def clean(self, value): return forms.CharField.clean(self, value.strip()) class Form1(forms.Form): f1 = TrimmedCharField(widget=forms.Textarea(attrs={‘rows’: 6})) f2= TrimmedCharField(widget=forms.Textarea(attrs={‘rows’: 6}))
In most cases when a user registers in your django application you need to know more than just user name, password and e-mail. To add custom fields to the registration form you should pass form_class parameter to the register view function — it’s easy, but saving additional data could be rather complex. There are solutions [...]