Suppose I had this form:

class BaseForm(forms.Form):
    field1 = forms.CharField(...)
    field2 = forms.Charfield(...)

And then in a subclass, I had:

class SubForm(BaseForm):
    field1 = forms.EmailField(...)

What's a good way to remove field2 in SubForm?  Setting field2 = None
didn't work.  I've been resorting to a custom widget that doesn't
display any HTML, but there must be a better way?

I guess I could write an __init__ method that checks for the existence
of field2 and removes it as an attribute, but that doesn't feel very
clean.

-- dz

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to