You added an __init__ to your ModelForm class?  If so, try this: add a
"fields" definition to your ModelForm's Meta class that includes this
new field.  You can read more about it here:

http://www.djangoproject.com/documentation/modelforms/#using-a-subset-of-fields-on-the-form

On Jul 6, 5:35 am, chefsmart <[EMAIL PROTECTED]> wrote:
> > > >> self.fields['short_name'] = forms.CharField(label='Short Name', 
> > > >> max_length=9)
>
> > > This code would need to be added to an overridden __init__ in your
> > > ModelForm.
>
> I tried this, however it didnn't work. It seems like the form already
> exists when __init__ is executed.
>
> On Jul 3, 9:42 pm, chefsmart <[EMAIL PROTECTED]> wrote:
>
> > Thanks for the tip. I'm guessing this is for the newforms-admin or at
> > least the svn trunk. I'm not adding the extra field to the model
> > because it doesn't really belong there, though it's related to the
> > model.
>
> > On Jul 3, 6:10 pm, Huuuze <[EMAIL PROTECTED]> wrote:
>
> > > Yes, you can do that, but you'd need to add it to the ModelForm's
> > > fields:
>
> > > >> self.fields['short_name'] = forms.CharField(label='Short Name', 
> > > >> max_length=9)
>
> > > This code would need to be added to an overridden __init__ in your
> > > ModelForm.  One question, however: why don't you add this field to
> > > your model?
>
> > > On Jul 3, 4:56 am,chefsmart<[EMAIL PROTECTED]> wrote:
>
> > > > Please see the following dpaste code.http://dpaste.com/60529/
>
> > > > There is a model, with a ModelForm. The ModelForm has a "short_name"
> > > > field that is not part of the model. Is this even possible/legal?
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to