Monkey patching a Django form class?
问题 Given a form class (somewhere deep in your giant Django app).. class ContactForm(forms.Form): name = ... surname = ... And considering you want to add another field to this form without extending or modifying the form class itself , why does not the following approach work? ContactForm.another_field = forms.CharField(...) (My first guess is that the metaclass hackery that Django uses applies only the first time the form class is constructed. If so, would there be a way to redeclare the class