i have set A that has many-to-many relationship with set B
currently admin interface (at least) forces me to select at least one
object from B if i add an object to A and the other way around. i do
not want that. i want to add an object to A which has no related
objects in B.
i need to have a model that enables empty relations. is there a way to
achieve this?
thanks
konstantin
You need to have specified null=True and blank=True on the
ManyToManyField in your model (and you need to have done that before you
created the database, otherwise it will not permit NULL values in that
column). If you do that, it should work fine.
Regards,
Malcolm
specifying null=True for ManyToManyField will allow nulls in the
corresponding field in the association table, right? but since this
table is just a list of pairs this is not needed because having no
row at all has the same effect. correct? if so null=True is not
really necessary. or am i wrong?
konstantin
On Feb 17, 8:15 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
that is correct, null has no effect for ManyToMany Field
>
> konstantin
>
> On Feb 17, 8:15 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
> wrote:
> > On Sun, 2007-02-18 at 01:09 +0000, akonsu wrote:
> > > Hello,
> >
> > > i have set A that has many-to-many relationship with set B
> >
> > > currently admin interface (at least) forces me to select at least one
> > > object from B if i add an object to A and the other way around. i do
> > > not want that. i want to add an object to A which has no related
> > > objects in B.
> >
> > > i need to have a model that enables empty relations. is there a way to
> > > achieve this?
> >
> > You need to have specified null=True and blank=True on the
> > ManyToManyField in your model (and you need to have done that before you
> > created the database, otherwise it will not permit NULL values in that
> > column). If you do that, it should work fine.
> >
> > Regards,
> > Malcolm
>
>
> >
>
--
Honza Král
E-Mail: Honza...@gmail.com
ICQ#: 107471613
Phone: +420 606 678585