No. Place this code right after the SubForm definition.

On Fri, Feb 20, 2009 at 6:42 PM, David Zhou <da...@nodnod.net> wrote:

>
> Do you mean del self.fields['field2'] in SubForm's __init__?
>
> -- dz
>
>
>
> On Fri, Feb 20, 2009 at 10:39 AM, Alex Koshelev <daeva...@gmail.com>
> wrote:
> > Try this:
> >
> > del SubForm.fields['fields2']
> >
> >
> > On Fri, Feb 20, 2009 at 6:15 PM, David Zhou <da...@nodnod.net> wrote:
> >>
> >> 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