Friday, October 28, 2011

Re: create object instance with ManyToManyField

Hello Leonardo,

thanks your your answer.

> n = Company(name=my_name, country=my_country, isin=my_isin)
> n.save()
> n.indices.add(my_indices)

This causes that the company object has all indices in my_indices
(such as Dow Jones S&P 100, Dax, ...) as *choices*. I.e. someone who
manipulates these objects via the admin interface is now able to
choose one or several of them and save the object again. What I want
to do is choose one or several of the indices in my program and then
save the object.

Jaroslav

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment