Thanks, that clears my doubts!

I was thinking that somehow the inlineformset_factory would be able to
take in the modelform for the parent model as well as the modelform
for the model we intend to edit inline; and then I would be able to
display them together like in the admin. I was obviously thinking
along the wrong lines.

Regards,
CM.

On Jun 29, 9:48 am, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Sun, Jun 28, 2009 at 11:46 PM, chefsmart <moran.cors...@gmail.com> wrote:
>
> > Hi Alex,
>
> > If we take the example from the documentation, let's say I have
> > modelforms for both Author and Book. So there is an AuthorModelForm
> > (ModelForm) and also a BookModelForm(ModelForm).
>
> > I can do MyFormSet = inlineformset_factory(Author, Book,
> > form=BookModelForm)
>
> > But is it possible to use the AuthorModelForm also?
>
> > Regards,
> > CM.
>
> > On Jun 29, 9:40 am, Alex Gaynor <alex.gay...@gmail.com> wrote:
> > > On Sun, Jun 28, 2009 at 11:38 PM, chefsmart <moran.cors...@gmail.com>
> > wrote:
>
> > > > If I understand correctly, I can use the form argument to supply a
> > > > modelform. But actually I have custom modelforms for both the models.
> > > > So I hoping to be able to use both if possible?
>
> > > > Regards,
> > > > CM.
>
> > > > On Jun 29, 9:24 am, Alex Gaynor <alex.gay...@gmail.com> wrote:
> > > > > On Sun, Jun 28, 2009 at 11:23 PM, chefsmart <moran.cors...@gmail.com
>
> > > > wrote:
>
> > > > > > Hi,
>
> > > > > > The Django documentation gives the following example for
> > > > > > inlineformset_factory: -
>
> > > > > > BookFormSet = inlineformset_factory(Author, Book)
>
> > > > > > This can be found on
>
> >http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#inline-.
> > > > ..
>
> > > > > > However, if I have custom modelforms for Author and Book, is it
> > > > > > possible to use them with  inlineformset_factory?
>
> > > > > > Regards,
> > > > > > CM.
>
> > > > > inlineformset_factory takes a form argument which should be the
> > modelform
> > > > > class that will be used with it.
>
> > > > > Alex
>
> > > > > --
> > > > > "I disapprove of what you say, but I will defend to the death your
> > right
> > > > to
> > > > > say it." --Voltaire
> > > > > "The people's good is the highest law."--Cicero
>
> > > An inlineformset only generates forms for 1 model, so you may be talking
> > > about having an inlineformset as well as another form.
>
> > > Alex
>
> > > --
> > > "I disapprove of what you say, but I will defend to the death your right
> > to
> > > say it." --Voltaire
> > > "The people's good is the highest law."--Cicero
>
> I'm not sure I follow, what do you want to do with the AuthorModelForm?  You
> can use it as well in your view, instantiate both and pass both of them to
> the template, but you can't you it as well as a part of the BookFormSet
> itself.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~---------~--~----~------------~-------~--~----~
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