you have to do the following
n = Company(name=my_name, country=my_country, isin=my_isin)
n.save()
n.indices.add(my_indices)
Bye
2011/10/27 Jaroslav Dobrek <jarosla...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>
In the admin interface, when you edit a Company object, you see a
convenient automagically-created
menu which lists all Index object in your application, and there you
can add or remove them.
But you can add Indexes with the snipped I gave you; if you pass as
"my_indices" some of the
available Indexes and then edit the object through the admin interface
you'll see the ones you added
as selected (in blue).
*Choices* in the admin interface are build through an automatic query;
Django sees that you use a m2m field
and populates it with TheTypeYouReference.objects.all() . But this is
a service of the forms in the admin interface.
Django objects have nothing to do with "choices", they simply know
that you are attaching the index of some
other object to the object you are creating.
Feel free to ask again if the matter is not clear.
2011/10/28 Jaroslav Dobrek <jarosla...@gmail.com>: